@@ -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,9 @@ fn claim_bolt12_payment<'a, 'b, 'c>(
188188 } ,
189189 _ => panic ! ( "Unexpected payment purpose: {:?}" , payment_purpose) ,
190190 }
191- claim_payment ( node, path, payment_preimage) ;
191+ if let Some ( inv) = claim_payment ( node, path, payment_preimage) {
192+ assert_eq ! ( inv, invoice. to_owned( ) ) ;
193+ } ;
192194}
193195
194196fn extract_offer_nonce < ' a , ' b , ' c > ( node : & Node < ' a , ' b , ' c > , message : & OnionMessage ) -> Nonce {
@@ -597,7 +599,7 @@ fn creates_and_pays_for_offer_using_two_hop_blinded_path() {
597599 route_bolt12_payment ( david, & [ charlie, bob, alice] , & invoice) ;
598600 expect_recent_payment ! ( david, RecentPaymentDetails :: Pending , payment_id) ;
599601
600- claim_bolt12_payment ( david, & [ charlie, bob, alice] , payment_context) ;
602+ claim_bolt12_payment ( david, & [ charlie, bob, alice] , payment_context, & invoice ) ;
601603 expect_recent_payment ! ( david, RecentPaymentDetails :: Fulfilled , payment_id) ;
602604}
603605
@@ -680,7 +682,7 @@ fn creates_and_pays_for_refund_using_two_hop_blinded_path() {
680682 route_bolt12_payment ( david, & [ charlie, bob, alice] , & invoice) ;
681683 expect_recent_payment ! ( david, RecentPaymentDetails :: Pending , payment_id) ;
682684
683- claim_bolt12_payment ( david, & [ charlie, bob, alice] , payment_context) ;
685+ claim_bolt12_payment ( david, & [ charlie, bob, alice] , payment_context, & invoice ) ;
684686 expect_recent_payment ! ( david, RecentPaymentDetails :: Fulfilled , payment_id) ;
685687}
686688
@@ -747,7 +749,7 @@ fn creates_and_pays_for_offer_using_one_hop_blinded_path() {
747749 route_bolt12_payment ( bob, & [ alice] , & invoice) ;
748750 expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
749751
750- claim_bolt12_payment ( bob, & [ alice] , payment_context) ;
752+ claim_bolt12_payment ( bob, & [ alice] , payment_context, & invoice ) ;
751753 expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
752754}
753755
@@ -803,7 +805,7 @@ fn creates_and_pays_for_refund_using_one_hop_blinded_path() {
803805 route_bolt12_payment ( bob, & [ alice] , & invoice) ;
804806 expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
805807
806- claim_bolt12_payment ( bob, & [ alice] , payment_context) ;
808+ claim_bolt12_payment ( bob, & [ alice] , payment_context, & invoice ) ;
807809 expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
808810}
809811
@@ -857,7 +859,7 @@ fn pays_for_offer_without_blinded_paths() {
857859 route_bolt12_payment ( bob, & [ alice] , & invoice) ;
858860 expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
859861
860- claim_bolt12_payment ( bob, & [ alice] , payment_context) ;
862+ claim_bolt12_payment ( bob, & [ alice] , payment_context, & invoice ) ;
861863 expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
862864}
863865
@@ -900,7 +902,7 @@ fn pays_for_refund_without_blinded_paths() {
900902 route_bolt12_payment ( bob, & [ alice] , & invoice) ;
901903 expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
902904
903- claim_bolt12_payment ( bob, & [ alice] , payment_context) ;
905+ claim_bolt12_payment ( bob, & [ alice] , payment_context, & invoice ) ;
904906 expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
905907}
906908
@@ -1138,7 +1140,7 @@ fn creates_and_pays_for_offer_with_retry() {
11381140 }
11391141 route_bolt12_payment ( bob, & [ alice] , & invoice) ;
11401142 expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
1141- claim_bolt12_payment ( bob, & [ alice] , payment_context) ;
1143+ claim_bolt12_payment ( bob, & [ alice] , payment_context, & invoice ) ;
11421144 expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
11431145}
11441146
@@ -1209,7 +1211,7 @@ fn pays_bolt12_invoice_asynchronously() {
12091211 route_bolt12_payment ( bob, & [ alice] , & invoice) ;
12101212 expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
12111213
1212- claim_bolt12_payment ( bob, & [ alice] , payment_context) ;
1214+ claim_bolt12_payment ( bob, & [ alice] , payment_context, & invoice ) ;
12131215 expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
12141216
12151217 assert_eq ! (
@@ -1289,7 +1291,7 @@ fn creates_offer_with_blinded_path_using_unannounced_introduction_node() {
12891291 route_bolt12_payment ( bob, & [ alice] , & invoice) ;
12901292 expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
12911293
1292- claim_bolt12_payment ( bob, & [ alice] , payment_context) ;
1294+ claim_bolt12_payment ( bob, & [ alice] , payment_context, & invoice ) ;
12931295 expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
12941296}
12951297
@@ -2145,7 +2147,7 @@ fn fails_paying_invoice_more_than_once() {
21452147 assert ! ( david. node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
21462148
21472149 // Complete paying the first invoice
2148- claim_bolt12_payment ( david, & [ charlie, bob, alice] , payment_context) ;
2150+ claim_bolt12_payment ( david, & [ charlie, bob, alice] , payment_context, & invoice1 ) ;
21492151 expect_recent_payment ! ( david, RecentPaymentDetails :: Fulfilled , payment_id) ;
21502152}
21512153
0 commit comments