@@ -46,11 +46,12 @@ use crate::blinded_path::BlindedPath;
46
46
use crate :: blinded_path:: payment:: PaymentContext ;
47
47
use crate :: events:: { Event , MessageSendEventsProvider , PaymentPurpose } ;
48
48
use crate :: ln:: channelmanager:: { PaymentId , RecentPaymentDetails , Retry , self } ;
49
+ use crate :: ln:: features:: InvoiceRequestFeatures ;
49
50
use crate :: ln:: functional_test_utils:: * ;
50
51
use crate :: ln:: msgs:: { ChannelMessageHandler , Init , NodeAnnouncement , OnionMessage , OnionMessageHandler , RoutingMessageHandler , SocketAddress , UnsignedGossipMessage , UnsignedNodeAnnouncement } ;
51
52
use crate :: offers:: invoice:: Bolt12Invoice ;
52
53
use crate :: offers:: invoice_error:: InvoiceError ;
53
- use crate :: offers:: invoice_request:: InvoiceRequest ;
54
+ use crate :: offers:: invoice_request:: { InvoiceRequest , InvoiceRequestFields } ;
54
55
use crate :: offers:: parse:: Bolt12SemanticError ;
55
56
use crate :: onion_message:: messenger:: PeeledOnion ;
56
57
use crate :: onion_message:: offers:: OffersMessage ;
@@ -380,7 +381,6 @@ fn creates_and_pays_for_offer_using_two_hop_blinded_path() {
380
381
. unwrap ( )
381
382
. amount_msats ( 10_000_000 )
382
383
. build ( ) . unwrap ( ) ;
383
- let payment_context = PaymentContext :: Bolt12Offer { offer_id : offer. id ( ) } ;
384
384
assert_ne ! ( offer. signing_pubkey( ) , alice_id) ;
385
385
assert ! ( !offer. paths( ) . is_empty( ) ) ;
386
386
for path in offer. paths ( ) {
@@ -403,6 +403,17 @@ fn creates_and_pays_for_offer_using_two_hop_blinded_path() {
403
403
alice. onion_messenger . handle_onion_message ( & bob_id, & onion_message) ;
404
404
405
405
let ( invoice_request, reply_path) = extract_invoice_request ( alice, & onion_message) ;
406
+ let payment_context = PaymentContext :: Bolt12Offer {
407
+ offer_id : offer. id ( ) ,
408
+ invoice_request : InvoiceRequestFields {
409
+ payer_id : invoice_request. payer_id ( ) ,
410
+ chain : Some ( invoice_request. chain ( ) ) ,
411
+ amount_msats : None ,
412
+ features : InvoiceRequestFeatures :: empty ( ) ,
413
+ quantity : None ,
414
+ payer_note : None ,
415
+ } ,
416
+ } ;
406
417
assert_eq ! ( invoice_request. amount_msats( ) , None ) ;
407
418
assert_ne ! ( invoice_request. payer_id( ) , david_id) ;
408
419
assert_eq ! ( reply_path. unwrap( ) . introduction_node_id, charlie_id) ;
@@ -532,7 +543,6 @@ fn creates_and_pays_for_offer_using_one_hop_blinded_path() {
532
543
. create_offer_builder ( "coffee" . to_string ( ) ) . unwrap ( )
533
544
. amount_msats ( 10_000_000 )
534
545
. build ( ) . unwrap ( ) ;
535
- let payment_context = PaymentContext :: Bolt12Offer { offer_id : offer. id ( ) } ;
536
546
assert_ne ! ( offer. signing_pubkey( ) , alice_id) ;
537
547
assert ! ( !offer. paths( ) . is_empty( ) ) ;
538
548
for path in offer. paths ( ) {
@@ -547,6 +557,17 @@ fn creates_and_pays_for_offer_using_one_hop_blinded_path() {
547
557
alice. onion_messenger . handle_onion_message ( & bob_id, & onion_message) ;
548
558
549
559
let ( invoice_request, reply_path) = extract_invoice_request ( alice, & onion_message) ;
560
+ let payment_context = PaymentContext :: Bolt12Offer {
561
+ offer_id : offer. id ( ) ,
562
+ invoice_request : InvoiceRequestFields {
563
+ payer_id : invoice_request. payer_id ( ) ,
564
+ chain : Some ( invoice_request. chain ( ) ) ,
565
+ amount_msats : None ,
566
+ features : InvoiceRequestFeatures :: empty ( ) ,
567
+ quantity : None ,
568
+ payer_note : None ,
569
+ } ,
570
+ } ;
550
571
assert_eq ! ( invoice_request. amount_msats( ) , None ) ;
551
572
assert_ne ! ( invoice_request. payer_id( ) , bob_id) ;
552
573
assert_eq ! ( reply_path. unwrap( ) . introduction_node_id, bob_id) ;
@@ -648,7 +669,6 @@ fn pays_for_offer_without_blinded_paths() {
648
669
. clear_paths ( )
649
670
. amount_msats ( 10_000_000 )
650
671
. build ( ) . unwrap ( ) ;
651
- let payment_context = PaymentContext :: Bolt12Offer { offer_id : offer. id ( ) } ;
652
672
assert_eq ! ( offer. signing_pubkey( ) , alice_id) ;
653
673
assert ! ( offer. paths( ) . is_empty( ) ) ;
654
674
@@ -659,6 +679,19 @@ fn pays_for_offer_without_blinded_paths() {
659
679
let onion_message = bob. onion_messenger . next_onion_message_for_peer ( alice_id) . unwrap ( ) ;
660
680
alice. onion_messenger . handle_onion_message ( & bob_id, & onion_message) ;
661
681
682
+ let ( invoice_request, _) = extract_invoice_request ( alice, & onion_message) ;
683
+ let payment_context = PaymentContext :: Bolt12Offer {
684
+ offer_id : offer. id ( ) ,
685
+ invoice_request : InvoiceRequestFields {
686
+ payer_id : invoice_request. payer_id ( ) ,
687
+ chain : Some ( invoice_request. chain ( ) ) ,
688
+ amount_msats : None ,
689
+ features : InvoiceRequestFeatures :: empty ( ) ,
690
+ quantity : None ,
691
+ payer_note : None ,
692
+ } ,
693
+ } ;
694
+
662
695
let onion_message = alice. onion_messenger . next_onion_message_for_peer ( bob_id) . unwrap ( ) ;
663
696
bob. onion_messenger . handle_onion_message ( & alice_id, & onion_message) ;
664
697
0 commit comments