@@ -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_paths : Vec < BlindedPath > ,
81
81
}
82
82
83
83
/// Builds a [`StaticInvoice`] from an [`Offer`].
@@ -98,14 +98,14 @@ 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 ,
101
+ async_receive_paths : Vec < BlindedPath > , created_at : Duration , expanded_key : & ExpandedKey ,
102
102
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 ( ) || async_receive_paths . is_empty ( ) || offer. paths ( ) . is_empty ( ) {
109
109
return Err ( Bolt12SemanticError :: MissingPaths ) ;
110
110
}
111
111
@@ -123,8 +123,13 @@ impl<'a> StaticInvoiceBuilder<'a> {
123
123
return Err ( Bolt12SemanticError :: InvalidSigningPubkey ) ;
124
124
}
125
125
126
- let invoice =
127
- InvoiceContents :: new ( offer, payment_paths, message_paths, created_at, signing_pubkey) ;
126
+ let invoice = InvoiceContents :: new (
127
+ offer,
128
+ payment_paths,
129
+ async_receive_paths,
130
+ created_at,
131
+ signing_pubkey,
132
+ ) ;
128
133
129
134
Ok ( Self { offer_bytes : & offer. bytes , invoice, keys } )
130
135
}
@@ -230,8 +235,8 @@ macro_rules! invoice_accessors { ($self: ident, $contents: expr) => {
230
235
231
236
/// Paths to the recipient for indicating that a held HTLC is available to claim when they next
232
237
/// come online.
233
- pub fn message_paths ( & $self) -> & [ BlindedPath ] {
234
- $contents. message_paths ( )
238
+ pub fn async_receive_paths ( & $self) -> & [ BlindedPath ] {
239
+ $contents. async_receive_paths ( )
235
240
}
236
241
237
242
/// The quantity of items supported, from [`Offer::supported_quantity`].
@@ -327,12 +332,12 @@ impl InvoiceContents {
327
332
328
333
fn new (
329
334
offer : & Offer , payment_paths : Vec < ( BlindedPayInfo , BlindedPath ) > ,
330
- message_paths : Vec < BlindedPath > , created_at : Duration , signing_pubkey : PublicKey ,
335
+ async_receive_paths : Vec < BlindedPath > , created_at : Duration , signing_pubkey : PublicKey ,
331
336
) -> Self {
332
337
Self {
333
338
offer : offer. contents . clone ( ) ,
334
339
payment_paths,
335
- message_paths ,
340
+ async_receive_paths ,
336
341
created_at,
337
342
relative_expiry : None ,
338
343
fallbacks : None ,
@@ -352,7 +357,7 @@ impl InvoiceContents {
352
357
353
358
let invoice = InvoiceTlvStreamRef {
354
359
paths : Some ( Iterable ( self . payment_paths . iter ( ) . map ( |( _, path) | path) ) ) ,
355
- message_paths : Some ( self . message_paths . as_ref ( ) ) ,
360
+ invoice_message_paths : Some ( self . async_receive_paths . as_ref ( ) ) ,
356
361
blindedpay : Some ( Iterable ( self . payment_paths . iter ( ) . map ( |( payinfo, _) | payinfo) ) ) ,
357
362
created_at : Some ( self . created_at . as_secs ( ) ) ,
358
363
relative_expiry : self . relative_expiry . map ( |duration| duration. as_secs ( ) as u32 ) ,
@@ -399,8 +404,8 @@ impl InvoiceContents {
399
404
self . offer . paths ( )
400
405
}
401
406
402
- fn message_paths ( & self ) -> & [ BlindedPath ] {
403
- & self . message_paths [ ..]
407
+ fn async_receive_paths ( & self ) -> & [ BlindedPath ] {
408
+ & self . async_receive_paths [ ..]
404
409
}
405
410
406
411
fn supported_quantity ( & self ) -> Quantity {
@@ -510,7 +515,7 @@ impl TryFrom<PartialInvoiceTlvStream> for InvoiceContents {
510
515
fallbacks,
511
516
features,
512
517
node_id,
513
- message_paths ,
518
+ invoice_message_paths ,
514
519
payment_hash,
515
520
amount,
516
521
} ,
@@ -524,7 +529,7 @@ impl TryFrom<PartialInvoiceTlvStream> for InvoiceContents {
524
529
}
525
530
526
531
let payment_paths = construct_payment_paths ( blindedpay, paths) ?;
527
- let message_paths = message_paths . ok_or ( Bolt12SemanticError :: MissingPaths ) ?;
532
+ let async_receive_paths = invoice_message_paths . ok_or ( Bolt12SemanticError :: MissingPaths ) ?;
528
533
529
534
let created_at = match created_at {
530
535
None => return Err ( Bolt12SemanticError :: MissingCreationTime ) ,
@@ -548,7 +553,7 @@ impl TryFrom<PartialInvoiceTlvStream> for InvoiceContents {
548
553
Ok ( InvoiceContents {
549
554
offer : OfferContents :: try_from ( offer_tlv_stream) ?,
550
555
payment_paths,
551
- message_paths ,
556
+ async_receive_paths ,
552
557
created_at,
553
558
relative_expiry,
554
559
fallbacks,
@@ -679,7 +684,7 @@ mod tests {
679
684
assert_eq ! ( invoice. offer_features( ) , & OfferFeatures :: empty( ) ) ;
680
685
assert_eq ! ( invoice. absolute_expiry( ) , None ) ;
681
686
assert_eq ! ( invoice. offer_request_paths( ) , & [ blinded_path( ) ] ) ;
682
- assert_eq ! ( invoice. message_paths ( ) , & [ blinded_path( ) ] ) ;
687
+ assert_eq ! ( invoice. async_receive_paths ( ) , & [ blinded_path( ) ] ) ;
683
688
assert_eq ! ( invoice. issuer( ) , None ) ;
684
689
assert_eq ! ( invoice. supported_quantity( ) , Quantity :: One ) ;
685
690
assert_ne ! ( invoice. signing_pubkey( ) , recipient_pubkey( ) ) ;
@@ -726,7 +731,7 @@ mod tests {
726
731
fallbacks: None ,
727
732
features: None ,
728
733
node_id: Some ( & offer_signing_pubkey) ,
729
- message_paths : Some ( & paths) ,
734
+ invoice_message_paths : Some ( & paths) ,
730
735
} ,
731
736
SignatureTlvStreamRef { signature: Some ( & invoice. signature( ) ) } ,
732
737
)
@@ -1055,9 +1060,9 @@ mod tests {
1055
1060
}
1056
1061
1057
1062
// 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 ;
1063
+ let missing_async_receive_paths_invoice = invoice ( ) ;
1064
+ let mut tlv_stream = missing_async_receive_paths_invoice . as_tlv_stream ( ) ;
1065
+ tlv_stream. 1 . invoice_message_paths = None ;
1061
1066
match StaticInvoice :: try_from ( tlv_stream_to_bytes ( & tlv_stream) ) {
1062
1067
Ok ( _) => panic ! ( "expected error" ) ,
1063
1068
Err ( e) => {
0 commit comments