@@ -404,6 +404,7 @@ pub enum TaggedField {
404
404
Fallback ( Fallback ) ,
405
405
PrivateRoute ( PrivateRoute ) ,
406
406
PaymentSecret ( PaymentSecret ) ,
407
+ PaymentMetadata ( Vec < u8 > ) ,
407
408
Features ( InvoiceFeatures ) ,
408
409
}
409
410
@@ -469,6 +470,7 @@ pub mod constants {
469
470
pub const TAG_FALLBACK : u8 = 9 ;
470
471
pub const TAG_PRIVATE_ROUTE : u8 = 3 ;
471
472
pub const TAG_PAYMENT_SECRET : u8 = 16 ;
473
+ pub const TAG_PAYMENT_METADATA : u8 = 27 ;
472
474
pub const TAG_FEATURES : u8 = 5 ;
473
475
}
474
476
@@ -926,6 +928,10 @@ impl RawInvoice {
926
928
find_extract ! ( self . known_tagged_fields( ) , TaggedField :: PaymentSecret ( ref x) , x)
927
929
}
928
930
931
+ pub fn payment_metadata ( & self ) -> Option < & Vec < u8 > > {
932
+ find_extract ! ( self . known_tagged_fields( ) , TaggedField :: PaymentMetadata ( ref x) , x)
933
+ }
934
+
929
935
pub fn features ( & self ) -> Option < & InvoiceFeatures > {
930
936
find_extract ! ( self . known_tagged_fields( ) , TaggedField :: Features ( ref x) , x)
931
937
}
@@ -1188,6 +1194,11 @@ impl Invoice {
1188
1194
self . signed_invoice . payment_secret ( ) . expect ( "was checked by constructor" )
1189
1195
}
1190
1196
1197
+ /// Get the payment metadata blob if one was included in the invoice
1198
+ pub fn payment_metadata ( & self ) -> Option < & Vec < u8 > > {
1199
+ self . signed_invoice . payment_metadata ( )
1200
+ }
1201
+
1191
1202
/// Get the invoice features if they were included in the invoice
1192
1203
pub fn features ( & self ) -> Option < & InvoiceFeatures > {
1193
1204
self . signed_invoice . features ( )
@@ -1290,6 +1301,7 @@ impl TaggedField {
1290
1301
TaggedField :: Fallback ( _) => constants:: TAG_FALLBACK ,
1291
1302
TaggedField :: PrivateRoute ( _) => constants:: TAG_PRIVATE_ROUTE ,
1292
1303
TaggedField :: PaymentSecret ( _) => constants:: TAG_PAYMENT_SECRET ,
1304
+ TaggedField :: PaymentMetadata ( _) => constants:: TAG_PAYMENT_METADATA ,
1293
1305
TaggedField :: Features ( _) => constants:: TAG_FEATURES ,
1294
1306
} ;
1295
1307
0 commit comments