@@ -168,7 +168,7 @@ fn route_bolt12_payment<'a, 'b, 'c>(
168168}
169169
170170fn claim_bolt12_payment < ' a , ' b , ' c > (
171- node : & Node < ' a , ' b , ' c > , path : & [ & Node < ' a , ' b , ' c > ] , expected_payment_context : PaymentContext
171+ node : & Node < ' a , ' b , ' c > , path : & [ & Node < ' a , ' b , ' c > ] , expected_payment_context : PaymentContext , invoice : & Bolt12Invoice
172172) {
173173 let recipient = & path[ path. len ( ) - 1 ] ;
174174 let payment_purpose = match get_event ! ( recipient, Event :: PaymentClaimable ) {
@@ -188,7 +188,10 @@ fn claim_bolt12_payment<'a, 'b, 'c>(
188188 } ,
189189 _ => panic ! ( "Unexpected payment purpose: {:?}" , payment_purpose) ,
190190 }
191- claim_payment ( node, path, payment_preimage) ;
191+ let Some ( inv) = claim_payment ( node, path, payment_preimage) else {
192+ return ;
193+ } ;
194+ assert_eq ! ( inv, invoice. to_owned( ) ) ;
192195}
193196
194197fn extract_offer_nonce < ' a , ' b , ' c > ( node : & Node < ' a , ' b , ' c > , message : & OnionMessage ) -> Nonce {
@@ -597,7 +600,7 @@ fn creates_and_pays_for_offer_using_two_hop_blinded_path() {
597600 route_bolt12_payment ( david, & [ charlie, bob, alice] , & invoice) ;
598601 expect_recent_payment ! ( david, RecentPaymentDetails :: Pending , payment_id) ;
599602
600- claim_bolt12_payment ( david, & [ charlie, bob, alice] , payment_context) ;
603+ claim_bolt12_payment ( david, & [ charlie, bob, alice] , payment_context, & invoice ) ;
601604 expect_recent_payment ! ( david, RecentPaymentDetails :: Fulfilled , payment_id) ;
602605}
603606
@@ -680,7 +683,7 @@ fn creates_and_pays_for_refund_using_two_hop_blinded_path() {
680683 route_bolt12_payment ( david, & [ charlie, bob, alice] , & invoice) ;
681684 expect_recent_payment ! ( david, RecentPaymentDetails :: Pending , payment_id) ;
682685
683- claim_bolt12_payment ( david, & [ charlie, bob, alice] , payment_context) ;
686+ claim_bolt12_payment ( david, & [ charlie, bob, alice] , payment_context, & invoice ) ;
684687 expect_recent_payment ! ( david, RecentPaymentDetails :: Fulfilled , payment_id) ;
685688}
686689
@@ -747,7 +750,7 @@ fn creates_and_pays_for_offer_using_one_hop_blinded_path() {
747750 route_bolt12_payment ( bob, & [ alice] , & invoice) ;
748751 expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
749752
750- claim_bolt12_payment ( bob, & [ alice] , payment_context) ;
753+ claim_bolt12_payment ( bob, & [ alice] , payment_context, & invoice ) ;
751754 expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
752755}
753756
@@ -803,7 +806,7 @@ fn creates_and_pays_for_refund_using_one_hop_blinded_path() {
803806 route_bolt12_payment ( bob, & [ alice] , & invoice) ;
804807 expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
805808
806- claim_bolt12_payment ( bob, & [ alice] , payment_context) ;
809+ claim_bolt12_payment ( bob, & [ alice] , payment_context, & invoice ) ;
807810 expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
808811}
809812
@@ -857,7 +860,7 @@ fn pays_for_offer_without_blinded_paths() {
857860 route_bolt12_payment ( bob, & [ alice] , & invoice) ;
858861 expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
859862
860- claim_bolt12_payment ( bob, & [ alice] , payment_context) ;
863+ claim_bolt12_payment ( bob, & [ alice] , payment_context, & invoice ) ;
861864 expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
862865}
863866
@@ -900,7 +903,7 @@ fn pays_for_refund_without_blinded_paths() {
900903 route_bolt12_payment ( bob, & [ alice] , & invoice) ;
901904 expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
902905
903- claim_bolt12_payment ( bob, & [ alice] , payment_context) ;
906+ claim_bolt12_payment ( bob, & [ alice] , payment_context, & invoice ) ;
904907 expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
905908}
906909
@@ -1138,7 +1141,7 @@ fn creates_and_pays_for_offer_with_retry() {
11381141 }
11391142 route_bolt12_payment ( bob, & [ alice] , & invoice) ;
11401143 expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
1141- claim_bolt12_payment ( bob, & [ alice] , payment_context) ;
1144+ claim_bolt12_payment ( bob, & [ alice] , payment_context, & invoice ) ;
11421145 expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
11431146}
11441147
@@ -1209,7 +1212,7 @@ fn pays_bolt12_invoice_asynchronously() {
12091212 route_bolt12_payment ( bob, & [ alice] , & invoice) ;
12101213 expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
12111214
1212- claim_bolt12_payment ( bob, & [ alice] , payment_context) ;
1215+ claim_bolt12_payment ( bob, & [ alice] , payment_context, & invoice ) ;
12131216 expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
12141217
12151218 assert_eq ! (
@@ -1289,7 +1292,7 @@ fn creates_offer_with_blinded_path_using_unannounced_introduction_node() {
12891292 route_bolt12_payment ( bob, & [ alice] , & invoice) ;
12901293 expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
12911294
1292- claim_bolt12_payment ( bob, & [ alice] , payment_context) ;
1295+ claim_bolt12_payment ( bob, & [ alice] , payment_context, & invoice ) ;
12931296 expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
12941297}
12951298
@@ -2145,7 +2148,7 @@ fn fails_paying_invoice_more_than_once() {
21452148 assert ! ( david. node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
21462149
21472150 // Complete paying the first invoice
2148- claim_bolt12_payment ( david, & [ charlie, bob, alice] , payment_context) ;
2151+ claim_bolt12_payment ( david, & [ charlie, bob, alice] , payment_context, & invoice1 ) ;
21492152 expect_recent_payment ! ( david, RecentPaymentDetails :: Fulfilled , payment_id) ;
21502153}
21512154
@@ -2405,4 +2408,3 @@ fn no_double_pay_with_stale_channelmanager() {
24052408 // generated in response to the duplicate invoice.
24062409 assert ! ( nodes[ 0 ] . node. get_and_clear_pending_events( ) . is_empty( ) ) ;
24072410}
2408-
0 commit comments