@@ -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`].
@@ -101,14 +101,17 @@ impl<'a> StaticInvoiceBuilder<'a> {
101
101
/// after `created_at`.
102
102
pub fn for_offer_using_derived_keys < T : secp256k1:: Signing > (
103
103
offer : & ' a Offer , payment_paths : Vec < ( BlindedPayInfo , BlindedPath ) > ,
104
- message_paths : Vec < BlindedPath > , created_at : Duration , expanded_key : & ExpandedKey ,
105
- secp_ctx : & Secp256k1 < T > ,
104
+ async_receive_message_paths : Vec < BlindedPath > , created_at : Duration ,
105
+ expanded_key : & ExpandedKey , secp_ctx : & Secp256k1 < T > ,
106
106
) -> Result < Self , Bolt12SemanticError > {
107
107
if offer. chains ( ) . len ( ) > 1 {
108
108
return Err ( Bolt12SemanticError :: UnexpectedChain ) ;
109
109
}
110
110
111
- if payment_paths. is_empty ( ) || message_paths. is_empty ( ) || offer. paths ( ) . is_empty ( ) {
111
+ if payment_paths. is_empty ( )
112
+ || async_receive_message_paths. is_empty ( )
113
+ || offer. paths ( ) . is_empty ( )
114
+ {
112
115
return Err ( Bolt12SemanticError :: MissingPaths ) ;
113
116
}
114
117
@@ -126,8 +129,13 @@ impl<'a> StaticInvoiceBuilder<'a> {
126
129
return Err ( Bolt12SemanticError :: InvalidSigningPubkey ) ;
127
130
}
128
131
129
- let invoice =
130
- InvoiceContents :: new ( offer, payment_paths, message_paths, created_at, signing_pubkey) ;
132
+ let invoice = InvoiceContents :: new (
133
+ offer,
134
+ payment_paths,
135
+ async_receive_message_paths,
136
+ created_at,
137
+ signing_pubkey,
138
+ ) ;
131
139
132
140
Ok ( Self { offer_bytes : & offer. bytes , invoice, keys } )
133
141
}
@@ -233,8 +241,8 @@ macro_rules! invoice_accessors { ($self: ident, $contents: expr) => {
233
241
234
242
/// Paths to the recipient for indicating that a held HTLC is available to claim when they next
235
243
/// come online.
236
- pub fn message_paths ( & $self) -> & [ BlindedPath ] {
237
- $contents. message_paths ( )
244
+ pub fn async_receive_message_paths ( & $self) -> & [ BlindedPath ] {
245
+ $contents. async_receive_message_paths ( )
238
246
}
239
247
240
248
/// The quantity of items supported, from [`Offer::supported_quantity`].
@@ -330,12 +338,13 @@ impl InvoiceContents {
330
338
331
339
fn new (
332
340
offer : & Offer , payment_paths : Vec < ( BlindedPayInfo , BlindedPath ) > ,
333
- message_paths : Vec < BlindedPath > , created_at : Duration , signing_pubkey : PublicKey ,
341
+ async_receive_message_paths : Vec < BlindedPath > , created_at : Duration ,
342
+ signing_pubkey : PublicKey ,
334
343
) -> Self {
335
344
Self {
336
345
offer : offer. contents . clone ( ) ,
337
346
payment_paths,
338
- message_paths ,
347
+ async_receive_message_paths ,
339
348
created_at,
340
349
relative_expiry : None ,
341
350
fallbacks : None ,
@@ -355,7 +364,7 @@ impl InvoiceContents {
355
364
356
365
let invoice = InvoiceTlvStreamRef {
357
366
paths : Some ( Iterable ( self . payment_paths . iter ( ) . map ( |( _, path) | path) ) ) ,
358
- message_paths : Some ( self . message_paths . as_ref ( ) ) ,
367
+ async_receive_message_paths : Some ( self . async_receive_message_paths . as_ref ( ) ) ,
359
368
blindedpay : Some ( Iterable ( self . payment_paths . iter ( ) . map ( |( payinfo, _) | payinfo) ) ) ,
360
369
created_at : Some ( self . created_at . as_secs ( ) ) ,
361
370
relative_expiry : self . relative_expiry . map ( |duration| duration. as_secs ( ) as u32 ) ,
@@ -402,8 +411,8 @@ impl InvoiceContents {
402
411
self . offer . paths ( )
403
412
}
404
413
405
- fn message_paths ( & self ) -> & [ BlindedPath ] {
406
- & self . message_paths [ ..]
414
+ fn async_receive_message_paths ( & self ) -> & [ BlindedPath ] {
415
+ & self . async_receive_message_paths [ ..]
407
416
}
408
417
409
418
fn supported_quantity ( & self ) -> Quantity {
@@ -514,7 +523,7 @@ impl TryFrom<PartialInvoiceTlvStream> for InvoiceContents {
514
523
fallbacks,
515
524
features,
516
525
node_id,
517
- message_paths ,
526
+ async_receive_message_paths ,
518
527
payment_hash,
519
528
amount,
520
529
} ,
@@ -528,7 +537,8 @@ impl TryFrom<PartialInvoiceTlvStream> for InvoiceContents {
528
537
}
529
538
530
539
let payment_paths = construct_payment_paths ( blindedpay, paths) ?;
531
- let message_paths = message_paths. ok_or ( Bolt12SemanticError :: MissingPaths ) ?;
540
+ let async_receive_message_paths =
541
+ async_receive_message_paths. ok_or ( Bolt12SemanticError :: MissingPaths ) ?;
532
542
533
543
let created_at = match created_at {
534
544
None => return Err ( Bolt12SemanticError :: MissingCreationTime ) ,
@@ -552,7 +562,7 @@ impl TryFrom<PartialInvoiceTlvStream> for InvoiceContents {
552
562
Ok ( InvoiceContents {
553
563
offer : OfferContents :: try_from ( offer_tlv_stream) ?,
554
564
payment_paths,
555
- message_paths ,
565
+ async_receive_message_paths ,
556
566
created_at,
557
567
relative_expiry,
558
568
fallbacks,
@@ -683,7 +693,7 @@ mod tests {
683
693
assert_eq ! ( invoice. offer_features( ) , & OfferFeatures :: empty( ) ) ;
684
694
assert_eq ! ( invoice. absolute_expiry( ) , None ) ;
685
695
assert_eq ! ( invoice. request_paths( ) , & [ blinded_path( ) ] ) ;
686
- assert_eq ! ( invoice. message_paths ( ) , & [ blinded_path( ) ] ) ;
696
+ assert_eq ! ( invoice. async_receive_message_paths ( ) , & [ blinded_path( ) ] ) ;
687
697
assert_eq ! ( invoice. issuer( ) , None ) ;
688
698
assert_eq ! ( invoice. supported_quantity( ) , Quantity :: One ) ;
689
699
assert_ne ! ( invoice. signing_pubkey( ) , recipient_pubkey( ) ) ;
@@ -730,7 +740,7 @@ mod tests {
730
740
fallbacks: None ,
731
741
features: None ,
732
742
node_id: Some ( & offer_signing_pubkey) ,
733
- message_paths : Some ( & paths) ,
743
+ async_receive_message_paths : Some ( & paths) ,
734
744
} ,
735
745
SignatureTlvStreamRef { signature: Some ( & invoice. signature( ) ) } ,
736
746
)
@@ -1059,9 +1069,9 @@ mod tests {
1059
1069
}
1060
1070
1061
1071
// Error if message paths are missing.
1062
- let missing_message_paths_invoice = invoice ( ) ;
1063
- let mut tlv_stream = missing_message_paths_invoice . as_tlv_stream ( ) ;
1064
- tlv_stream. 1 . message_paths = None ;
1072
+ let missing_async_receive_message_paths_invoice = invoice ( ) ;
1073
+ let mut tlv_stream = missing_async_receive_message_paths_invoice . as_tlv_stream ( ) ;
1074
+ tlv_stream. 1 . async_receive_message_paths = None ;
1065
1075
match StaticInvoice :: try_from ( tlv_stream_to_bytes ( & tlv_stream) ) {
1066
1076
Ok ( _) => panic ! ( "expected error" ) ,
1067
1077
Err ( e) => {
0 commit comments