@@ -374,6 +374,7 @@ pub enum TaggedField {
374
374
Fallback ( Fallback ) ,
375
375
PrivateRoute ( PrivateRoute ) ,
376
376
PaymentSecret ( PaymentSecret ) ,
377
+ PaymentMetadata ( Vec < u8 > ) ,
377
378
Features ( InvoiceFeatures ) ,
378
379
}
379
380
@@ -444,6 +445,7 @@ pub mod constants {
444
445
pub const TAG_FALLBACK : u8 = 9 ;
445
446
pub const TAG_PRIVATE_ROUTE : u8 = 3 ;
446
447
pub const TAG_PAYMENT_SECRET : u8 = 16 ;
448
+ pub const TAG_PAYMENT_METADATA : u8 = 27 ;
447
449
pub const TAG_FEATURES : u8 = 5 ;
448
450
}
449
451
@@ -917,6 +919,10 @@ impl RawInvoice {
917
919
find_extract ! ( self . known_tagged_fields( ) , TaggedField :: PaymentSecret ( ref x) , x)
918
920
}
919
921
922
+ pub fn payment_metadata ( & self ) -> Option < & Vec < u8 > > {
923
+ find_extract ! ( self . known_tagged_fields( ) , TaggedField :: PaymentMetadata ( ref x) , x)
924
+ }
925
+
920
926
pub fn features ( & self ) -> Option < & InvoiceFeatures > {
921
927
find_extract ! ( self . known_tagged_fields( ) , TaggedField :: Features ( ref x) , x)
922
928
}
@@ -1172,6 +1178,11 @@ impl Invoice {
1172
1178
self . signed_invoice . payment_secret ( ) . expect ( "was checked by constructor" )
1173
1179
}
1174
1180
1181
+ /// Get the payment metadata blob if one was included in the invoice
1182
+ pub fn payment_metadata ( & self ) -> Option < & Vec < u8 > > {
1183
+ self . signed_invoice . payment_metadata ( )
1184
+ }
1185
+
1175
1186
/// Get the invoice features if they were included in the invoice
1176
1187
pub fn features ( & self ) -> Option < & InvoiceFeatures > {
1177
1188
self . signed_invoice . features ( )
@@ -1264,6 +1275,7 @@ impl TaggedField {
1264
1275
TaggedField :: Fallback ( _) => constants:: TAG_FALLBACK ,
1265
1276
TaggedField :: PrivateRoute ( _) => constants:: TAG_PRIVATE_ROUTE ,
1266
1277
TaggedField :: PaymentSecret ( _) => constants:: TAG_PAYMENT_SECRET ,
1278
+ TaggedField :: PaymentMetadata ( _) => constants:: TAG_PAYMENT_METADATA ,
1267
1279
TaggedField :: Features ( _) => constants:: TAG_FEATURES ,
1268
1280
} ;
1269
1281
0 commit comments