@@ -200,12 +200,12 @@ fn extract_invoice_request<'a, 'b, 'c>(
200
200
}
201
201
}
202
202
203
- fn extract_invoice < ' a , ' b , ' c > ( node : & Node < ' a , ' b , ' c > , message : & OnionMessage ) -> Bolt12Invoice {
203
+ fn extract_invoice < ' a , ' b , ' c > ( node : & Node < ' a , ' b , ' c > , message : & OnionMessage ) -> ( Bolt12Invoice , BlindedPath ) {
204
204
match node. onion_messenger . peel_onion_message ( message) {
205
- Ok ( PeeledOnion :: Receive ( message, _, _ ) ) => match message {
205
+ Ok ( PeeledOnion :: Receive ( message, _, reply_path ) ) => match message {
206
206
ParsedOnionMessageContents :: Offers ( offers_message) => match offers_message {
207
207
OffersMessage :: InvoiceRequest ( invoice_request) => panic ! ( "Unexpected invoice_request: {:?}" , invoice_request) ,
208
- OffersMessage :: Invoice ( invoice) => invoice,
208
+ OffersMessage :: Invoice ( invoice) => ( invoice, reply_path . unwrap ( ) ) ,
209
209
OffersMessage :: InvoiceError ( error) => panic ! ( "Unexpected invoice_error: {:?}" , error) ,
210
210
} ,
211
211
ParsedOnionMessageContents :: Custom ( message) => panic ! ( "Unexpected custom message: {:?}" , message) ,
@@ -553,7 +553,7 @@ fn creates_and_pays_for_offer_using_two_hop_blinded_path() {
553
553
let onion_message = charlie. onion_messenger . next_onion_message_for_peer ( david_id) . unwrap ( ) ;
554
554
david. onion_messenger . handle_onion_message ( & charlie_id, & onion_message) ;
555
555
556
- let invoice = extract_invoice ( david, & onion_message) ;
556
+ let ( invoice, _ ) = extract_invoice ( david, & onion_message) ;
557
557
assert_eq ! ( invoice. amount_msats( ) , 10_000_000 ) ;
558
558
assert_ne ! ( invoice. signing_pubkey( ) , alice_id) ;
559
559
assert ! ( !invoice. payment_paths( ) . is_empty( ) ) ;
@@ -632,7 +632,7 @@ fn creates_and_pays_for_refund_using_two_hop_blinded_path() {
632
632
let onion_message = charlie. onion_messenger . next_onion_message_for_peer ( david_id) . unwrap ( ) ;
633
633
david. onion_messenger . handle_onion_message ( & charlie_id, & onion_message) ;
634
634
635
- let invoice = extract_invoice ( david, & onion_message) ;
635
+ let ( invoice, _ ) = extract_invoice ( david, & onion_message) ;
636
636
assert_eq ! ( invoice, expected_invoice) ;
637
637
638
638
assert_eq ! ( invoice. amount_msats( ) , 10_000_000 ) ;
@@ -699,7 +699,7 @@ fn creates_and_pays_for_offer_using_one_hop_blinded_path() {
699
699
let onion_message = alice. onion_messenger . next_onion_message_for_peer ( bob_id) . unwrap ( ) ;
700
700
bob. onion_messenger . handle_onion_message ( & alice_id, & onion_message) ;
701
701
702
- let invoice = extract_invoice ( bob, & onion_message) ;
702
+ let ( invoice, _ ) = extract_invoice ( bob, & onion_message) ;
703
703
assert_eq ! ( invoice. amount_msats( ) , 10_000_000 ) ;
704
704
assert_ne ! ( invoice. signing_pubkey( ) , alice_id) ;
705
705
assert ! ( !invoice. payment_paths( ) . is_empty( ) ) ;
@@ -752,7 +752,7 @@ fn creates_and_pays_for_refund_using_one_hop_blinded_path() {
752
752
let onion_message = alice. onion_messenger . next_onion_message_for_peer ( bob_id) . unwrap ( ) ;
753
753
bob. onion_messenger . handle_onion_message ( & alice_id, & onion_message) ;
754
754
755
- let invoice = extract_invoice ( bob, & onion_message) ;
755
+ let ( invoice, _ ) = extract_invoice ( bob, & onion_message) ;
756
756
assert_eq ! ( invoice, expected_invoice) ;
757
757
758
758
assert_eq ! ( invoice. amount_msats( ) , 10_000_000 ) ;
@@ -814,7 +814,7 @@ fn pays_for_offer_without_blinded_paths() {
814
814
let onion_message = alice. onion_messenger . next_onion_message_for_peer ( bob_id) . unwrap ( ) ;
815
815
bob. onion_messenger . handle_onion_message ( & alice_id, & onion_message) ;
816
816
817
- let invoice = extract_invoice ( bob, & onion_message) ;
817
+ let ( invoice, _ ) = extract_invoice ( bob, & onion_message) ;
818
818
route_bolt12_payment ( bob, & [ alice] , & invoice) ;
819
819
expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
820
820
@@ -855,7 +855,7 @@ fn pays_for_refund_without_blinded_paths() {
855
855
let onion_message = alice. onion_messenger . next_onion_message_for_peer ( bob_id) . unwrap ( ) ;
856
856
bob. onion_messenger . handle_onion_message ( & alice_id, & onion_message) ;
857
857
858
- let invoice = extract_invoice ( bob, & onion_message) ;
858
+ let ( invoice, _ ) = extract_invoice ( bob, & onion_message) ;
859
859
assert_eq ! ( invoice, expected_invoice) ;
860
860
861
861
route_bolt12_payment ( bob, & [ alice] , & invoice) ;
@@ -1352,7 +1352,7 @@ fn fails_paying_invoice_more_than_once() {
1352
1352
1353
1353
// David pays the first invoice
1354
1354
let payment_context = PaymentContext :: Bolt12Refund ( Bolt12RefundContext { } ) ;
1355
- let invoice1 = extract_invoice ( david, & onion_message) ;
1355
+ let ( invoice1, _ ) = extract_invoice ( david, & onion_message) ;
1356
1356
1357
1357
route_bolt12_payment ( david, & [ charlie, bob, alice] , & invoice1) ;
1358
1358
expect_recent_payment ! ( david, RecentPaymentDetails :: Pending , payment_id) ;
@@ -1374,7 +1374,7 @@ fn fails_paying_invoice_more_than_once() {
1374
1374
let onion_message = charlie. onion_messenger . next_onion_message_for_peer ( david_id) . unwrap ( ) ;
1375
1375
david. onion_messenger . handle_onion_message ( & charlie_id, & onion_message) ;
1376
1376
1377
- let invoice2 = extract_invoice ( david, & onion_message) ;
1377
+ let ( invoice2, _ ) = extract_invoice ( david, & onion_message) ;
1378
1378
assert_eq ! ( invoice1. payer_metadata( ) , invoice2. payer_metadata( ) ) ;
1379
1379
1380
1380
// David sends an error instead of paying the second invoice
0 commit comments