@@ -205,12 +205,12 @@ fn extract_invoice_request<'a, 'b, 'c>(
205
205
}
206
206
}
207
207
208
- fn extract_invoice < ' a , ' b , ' c > ( node : & Node < ' a , ' b , ' c > , message : & OnionMessage ) -> Bolt12Invoice {
208
+ fn extract_invoice < ' a , ' b , ' c > ( node : & Node < ' a , ' b , ' c > , message : & OnionMessage ) -> ( Bolt12Invoice , Option < BlindedPath > ) {
209
209
match node. onion_messenger . peel_onion_message ( message) {
210
- Ok ( PeeledOnion :: Receive ( message, _, _ ) ) => match message {
210
+ Ok ( PeeledOnion :: Receive ( message, _, reply_path ) ) => match message {
211
211
ParsedOnionMessageContents :: Offers ( offers_message) => match offers_message {
212
212
OffersMessage :: InvoiceRequest ( invoice_request) => panic ! ( "Unexpected invoice_request: {:?}" , invoice_request) ,
213
- OffersMessage :: Invoice ( invoice) => invoice,
213
+ OffersMessage :: Invoice ( invoice) => ( invoice, reply_path ) ,
214
214
#[ cfg( async_payments) ]
215
215
OffersMessage :: StaticInvoice ( invoice) => panic ! ( "Unexpected static invoice: {:?}" , invoice) ,
216
216
OffersMessage :: InvoiceError ( error) => panic ! ( "Unexpected invoice_error: {:?}" , error) ,
@@ -566,7 +566,7 @@ fn creates_and_pays_for_offer_using_two_hop_blinded_path() {
566
566
let onion_message = charlie. onion_messenger . next_onion_message_for_peer ( david_id) . unwrap ( ) ;
567
567
david. onion_messenger . handle_onion_message ( & charlie_id, & onion_message) ;
568
568
569
- let invoice = extract_invoice ( david, & onion_message) ;
569
+ let ( invoice, _ ) = extract_invoice ( david, & onion_message) ;
570
570
assert_eq ! ( invoice. amount_msats( ) , 10_000_000 ) ;
571
571
assert_ne ! ( invoice. signing_pubkey( ) , alice_id) ;
572
572
assert ! ( !invoice. payment_paths( ) . is_empty( ) ) ;
@@ -645,7 +645,7 @@ fn creates_and_pays_for_refund_using_two_hop_blinded_path() {
645
645
let onion_message = charlie. onion_messenger . next_onion_message_for_peer ( david_id) . unwrap ( ) ;
646
646
david. onion_messenger . handle_onion_message ( & charlie_id, & onion_message) ;
647
647
648
- let invoice = extract_invoice ( david, & onion_message) ;
648
+ let ( invoice, _ ) = extract_invoice ( david, & onion_message) ;
649
649
assert_eq ! ( invoice, expected_invoice) ;
650
650
651
651
assert_eq ! ( invoice. amount_msats( ) , 10_000_000 ) ;
@@ -712,7 +712,7 @@ fn creates_and_pays_for_offer_using_one_hop_blinded_path() {
712
712
let onion_message = alice. onion_messenger . next_onion_message_for_peer ( bob_id) . unwrap ( ) ;
713
713
bob. onion_messenger . handle_onion_message ( & alice_id, & onion_message) ;
714
714
715
- let invoice = extract_invoice ( bob, & onion_message) ;
715
+ let ( invoice, _ ) = extract_invoice ( bob, & onion_message) ;
716
716
assert_eq ! ( invoice. amount_msats( ) , 10_000_000 ) ;
717
717
assert_ne ! ( invoice. signing_pubkey( ) , alice_id) ;
718
718
assert ! ( !invoice. payment_paths( ) . is_empty( ) ) ;
@@ -765,7 +765,7 @@ fn creates_and_pays_for_refund_using_one_hop_blinded_path() {
765
765
let onion_message = alice. onion_messenger . next_onion_message_for_peer ( bob_id) . unwrap ( ) ;
766
766
bob. onion_messenger . handle_onion_message ( & alice_id, & onion_message) ;
767
767
768
- let invoice = extract_invoice ( bob, & onion_message) ;
768
+ let ( invoice, _ ) = extract_invoice ( bob, & onion_message) ;
769
769
assert_eq ! ( invoice, expected_invoice) ;
770
770
771
771
assert_eq ! ( invoice. amount_msats( ) , 10_000_000 ) ;
@@ -827,7 +827,7 @@ fn pays_for_offer_without_blinded_paths() {
827
827
let onion_message = alice. onion_messenger . next_onion_message_for_peer ( bob_id) . unwrap ( ) ;
828
828
bob. onion_messenger . handle_onion_message ( & alice_id, & onion_message) ;
829
829
830
- let invoice = extract_invoice ( bob, & onion_message) ;
830
+ let ( invoice, _ ) = extract_invoice ( bob, & onion_message) ;
831
831
route_bolt12_payment ( bob, & [ alice] , & invoice) ;
832
832
expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
833
833
@@ -868,7 +868,7 @@ fn pays_for_refund_without_blinded_paths() {
868
868
let onion_message = alice. onion_messenger . next_onion_message_for_peer ( bob_id) . unwrap ( ) ;
869
869
bob. onion_messenger . handle_onion_message ( & alice_id, & onion_message) ;
870
870
871
- let invoice = extract_invoice ( bob, & onion_message) ;
871
+ let ( invoice, _ ) = extract_invoice ( bob, & onion_message) ;
872
872
assert_eq ! ( invoice, expected_invoice) ;
873
873
874
874
route_bolt12_payment ( bob, & [ alice] , & invoice) ;
@@ -1012,7 +1012,7 @@ fn creates_offer_with_blinded_path_using_unannounced_introduction_node() {
1012
1012
let onion_message = alice. onion_messenger . next_onion_message_for_peer ( bob_id) . unwrap ( ) ;
1013
1013
bob. onion_messenger . handle_onion_message ( & alice_id, & onion_message) ;
1014
1014
1015
- let invoice = extract_invoice ( bob, & onion_message) ;
1015
+ let ( invoice, _ ) = extract_invoice ( bob, & onion_message) ;
1016
1016
assert_ne ! ( invoice. signing_pubkey( ) , alice_id) ;
1017
1017
assert ! ( !invoice. payment_paths( ) . is_empty( ) ) ;
1018
1018
for ( _, path) in invoice. payment_paths ( ) {
@@ -1061,7 +1061,7 @@ fn creates_refund_with_blinded_path_using_unannounced_introduction_node() {
1061
1061
1062
1062
let onion_message = alice. onion_messenger . next_onion_message_for_peer ( bob_id) . unwrap ( ) ;
1063
1063
1064
- let invoice = extract_invoice ( bob, & onion_message) ;
1064
+ let ( invoice, _ ) = extract_invoice ( bob, & onion_message) ;
1065
1065
assert_eq ! ( invoice, expected_invoice) ;
1066
1066
assert_ne ! ( invoice. signing_pubkey( ) , alice_id) ;
1067
1067
assert ! ( !invoice. payment_paths( ) . is_empty( ) ) ;
@@ -1525,7 +1525,7 @@ fn fails_paying_invoice_more_than_once() {
1525
1525
1526
1526
// David pays the first invoice
1527
1527
let payment_context = PaymentContext :: Bolt12Refund ( Bolt12RefundContext { } ) ;
1528
- let invoice1 = extract_invoice ( david, & onion_message) ;
1528
+ let ( invoice1, _ ) = extract_invoice ( david, & onion_message) ;
1529
1529
1530
1530
route_bolt12_payment ( david, & [ charlie, bob, alice] , & invoice1) ;
1531
1531
expect_recent_payment ! ( david, RecentPaymentDetails :: Pending , payment_id) ;
@@ -1547,7 +1547,7 @@ fn fails_paying_invoice_more_than_once() {
1547
1547
let onion_message = charlie. onion_messenger . next_onion_message_for_peer ( david_id) . unwrap ( ) ;
1548
1548
david. onion_messenger . handle_onion_message ( & charlie_id, & onion_message) ;
1549
1549
1550
- let invoice2 = extract_invoice ( david, & onion_message) ;
1550
+ let ( invoice2, _ ) = extract_invoice ( david, & onion_message) ;
1551
1551
assert_eq ! ( invoice1. payer_metadata( ) , invoice2. payer_metadata( ) ) ;
1552
1552
1553
1553
// David sends an error instead of paying the second invoice
0 commit comments