@@ -77,7 +77,7 @@ struct InvoiceContents {
77
77
fallbacks : Option < Vec < FallbackAddress > > ,
78
78
features : Bolt12InvoiceFeatures ,
79
79
signing_pubkey : PublicKey ,
80
- message_paths : Vec < BlindedPath > ,
80
+ async_receive_message_paths : Vec < BlindedPath > ,
81
81
}
82
82
83
83
/// Builds a [`StaticInvoice`] from an [`Offer`].
@@ -98,14 +98,17 @@ impl<'a> StaticInvoiceBuilder<'a> {
98
98
/// after `created_at`.
99
99
pub fn for_offer_using_derived_keys < T : secp256k1:: Signing > (
100
100
offer : & ' a Offer , payment_paths : Vec < ( BlindedPayInfo , BlindedPath ) > ,
101
- message_paths : Vec < BlindedPath > , created_at : Duration , expanded_key : & ExpandedKey ,
102
- secp_ctx : & Secp256k1 < T > ,
101
+ async_receive_message_paths : Vec < BlindedPath > , created_at : Duration ,
102
+ expanded_key : & ExpandedKey , secp_ctx : & Secp256k1 < T > ,
103
103
) -> Result < Self , Bolt12SemanticError > {
104
104
if offer. chains ( ) . len ( ) > 1 {
105
105
return Err ( Bolt12SemanticError :: UnexpectedChain ) ;
106
106
}
107
107
108
- if payment_paths. is_empty ( ) || message_paths. is_empty ( ) || offer. paths ( ) . is_empty ( ) {
108
+ if payment_paths. is_empty ( )
109
+ || async_receive_message_paths. is_empty ( )
110
+ || offer. paths ( ) . is_empty ( )
111
+ {
109
112
return Err ( Bolt12SemanticError :: MissingPaths ) ;
110
113
}
111
114
@@ -123,8 +126,13 @@ impl<'a> StaticInvoiceBuilder<'a> {
123
126
return Err ( Bolt12SemanticError :: InvalidSigningPubkey ) ;
124
127
}
125
128
126
- let invoice =
127
- InvoiceContents :: new ( offer, payment_paths, message_paths, created_at, signing_pubkey) ;
129
+ let invoice = InvoiceContents :: new (
130
+ offer,
131
+ payment_paths,
132
+ async_receive_message_paths,
133
+ created_at,
134
+ signing_pubkey,
135
+ ) ;
128
136
129
137
Ok ( Self { offer_bytes : & offer. bytes , invoice, keys } )
130
138
}
@@ -230,8 +238,8 @@ macro_rules! invoice_accessors { ($self: ident, $contents: expr) => {
230
238
231
239
/// Paths to the recipient for indicating that a held HTLC is available to claim when they next
232
240
/// come online.
233
- pub fn message_paths ( & $self) -> & [ BlindedPath ] {
234
- $contents. message_paths ( )
241
+ pub fn async_receive_message_paths ( & $self) -> & [ BlindedPath ] {
242
+ $contents. async_receive_message_paths ( )
235
243
}
236
244
237
245
/// The quantity of items supported, from [`Offer::supported_quantity`].
@@ -327,12 +335,13 @@ impl InvoiceContents {
327
335
328
336
fn new (
329
337
offer : & Offer , payment_paths : Vec < ( BlindedPayInfo , BlindedPath ) > ,
330
- message_paths : Vec < BlindedPath > , created_at : Duration , signing_pubkey : PublicKey ,
338
+ async_receive_message_paths : Vec < BlindedPath > , created_at : Duration ,
339
+ signing_pubkey : PublicKey ,
331
340
) -> Self {
332
341
Self {
333
342
offer : offer. contents . clone ( ) ,
334
343
payment_paths,
335
- message_paths ,
344
+ async_receive_message_paths ,
336
345
created_at,
337
346
relative_expiry : None ,
338
347
fallbacks : None ,
@@ -352,7 +361,7 @@ impl InvoiceContents {
352
361
353
362
let invoice = InvoiceTlvStreamRef {
354
363
paths : Some ( Iterable ( self . payment_paths . iter ( ) . map ( |( _, path) | path) ) ) ,
355
- message_paths : Some ( self . message_paths . as_ref ( ) ) ,
364
+ async_receive_message_paths : Some ( self . async_receive_message_paths . as_ref ( ) ) ,
356
365
blindedpay : Some ( Iterable ( self . payment_paths . iter ( ) . map ( |( payinfo, _) | payinfo) ) ) ,
357
366
created_at : Some ( self . created_at . as_secs ( ) ) ,
358
367
relative_expiry : self . relative_expiry . map ( |duration| duration. as_secs ( ) as u32 ) ,
@@ -399,8 +408,8 @@ impl InvoiceContents {
399
408
self . offer . paths ( )
400
409
}
401
410
402
- fn message_paths ( & self ) -> & [ BlindedPath ] {
403
- & self . message_paths [ ..]
411
+ fn async_receive_message_paths ( & self ) -> & [ BlindedPath ] {
412
+ & self . async_receive_message_paths [ ..]
404
413
}
405
414
406
415
fn supported_quantity ( & self ) -> Quantity {
@@ -510,7 +519,7 @@ impl TryFrom<PartialInvoiceTlvStream> for InvoiceContents {
510
519
fallbacks,
511
520
features,
512
521
node_id,
513
- message_paths ,
522
+ async_receive_message_paths ,
514
523
payment_hash,
515
524
amount,
516
525
} ,
@@ -524,7 +533,8 @@ impl TryFrom<PartialInvoiceTlvStream> for InvoiceContents {
524
533
}
525
534
526
535
let payment_paths = construct_payment_paths ( blindedpay, paths) ?;
527
- let message_paths = message_paths. ok_or ( Bolt12SemanticError :: MissingPaths ) ?;
536
+ let async_receive_message_paths =
537
+ async_receive_message_paths. ok_or ( Bolt12SemanticError :: MissingPaths ) ?;
528
538
529
539
let created_at = match created_at {
530
540
None => return Err ( Bolt12SemanticError :: MissingCreationTime ) ,
@@ -548,7 +558,7 @@ impl TryFrom<PartialInvoiceTlvStream> for InvoiceContents {
548
558
Ok ( InvoiceContents {
549
559
offer : OfferContents :: try_from ( offer_tlv_stream) ?,
550
560
payment_paths,
551
- message_paths ,
561
+ async_receive_message_paths ,
552
562
created_at,
553
563
relative_expiry,
554
564
fallbacks,
@@ -679,7 +689,7 @@ mod tests {
679
689
assert_eq ! ( invoice. offer_features( ) , & OfferFeatures :: empty( ) ) ;
680
690
assert_eq ! ( invoice. absolute_expiry( ) , None ) ;
681
691
assert_eq ! ( invoice. request_paths( ) , & [ blinded_path( ) ] ) ;
682
- assert_eq ! ( invoice. message_paths ( ) , & [ blinded_path( ) ] ) ;
692
+ assert_eq ! ( invoice. async_receive_message_paths ( ) , & [ blinded_path( ) ] ) ;
683
693
assert_eq ! ( invoice. issuer( ) , None ) ;
684
694
assert_eq ! ( invoice. supported_quantity( ) , Quantity :: One ) ;
685
695
assert_ne ! ( invoice. signing_pubkey( ) , recipient_pubkey( ) ) ;
@@ -726,7 +736,7 @@ mod tests {
726
736
fallbacks: None ,
727
737
features: None ,
728
738
node_id: Some ( & offer_signing_pubkey) ,
729
- message_paths : Some ( & paths) ,
739
+ async_receive_message_paths : Some ( & paths) ,
730
740
} ,
731
741
SignatureTlvStreamRef { signature: Some ( & invoice. signature( ) ) } ,
732
742
)
@@ -1055,9 +1065,9 @@ mod tests {
1055
1065
}
1056
1066
1057
1067
// Error if message paths are missing.
1058
- let missing_message_paths_invoice = invoice ( ) ;
1059
- let mut tlv_stream = missing_message_paths_invoice . as_tlv_stream ( ) ;
1060
- tlv_stream. 1 . message_paths = None ;
1068
+ let missing_async_receive_message_paths_invoice = invoice ( ) ;
1069
+ let mut tlv_stream = missing_async_receive_message_paths_invoice . as_tlv_stream ( ) ;
1070
+ tlv_stream. 1 . async_receive_message_paths = None ;
1061
1071
match StaticInvoice :: try_from ( tlv_stream_to_bytes ( & tlv_stream) ) {
1062
1072
Ok ( _) => panic ! ( "expected error" ) ,
1063
1073
Err ( e) => {
0 commit comments