@@ -168,7 +168,7 @@ fn route_bolt12_payment<'a, 'b, 'c>(
168
168
}
169
169
170
170
fn 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
172
172
) {
173
173
let recipient = & path[ path. len ( ) - 1 ] ;
174
174
let payment_purpose = match get_event ! ( recipient, Event :: PaymentClaimable ) {
@@ -188,7 +188,10 @@ fn claim_bolt12_payment<'a, 'b, 'c>(
188
188
} ,
189
189
_ => panic ! ( "Unexpected payment purpose: {:?}" , payment_purpose) ,
190
190
}
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( ) ) ;
192
195
}
193
196
194
197
fn 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() {
597
600
route_bolt12_payment ( david, & [ charlie, bob, alice] , & invoice) ;
598
601
expect_recent_payment ! ( david, RecentPaymentDetails :: Pending , payment_id) ;
599
602
600
- claim_bolt12_payment ( david, & [ charlie, bob, alice] , payment_context) ;
603
+ claim_bolt12_payment ( david, & [ charlie, bob, alice] , payment_context, & invoice ) ;
601
604
expect_recent_payment ! ( david, RecentPaymentDetails :: Fulfilled , payment_id) ;
602
605
}
603
606
@@ -680,7 +683,7 @@ fn creates_and_pays_for_refund_using_two_hop_blinded_path() {
680
683
route_bolt12_payment ( david, & [ charlie, bob, alice] , & invoice) ;
681
684
expect_recent_payment ! ( david, RecentPaymentDetails :: Pending , payment_id) ;
682
685
683
- claim_bolt12_payment ( david, & [ charlie, bob, alice] , payment_context) ;
686
+ claim_bolt12_payment ( david, & [ charlie, bob, alice] , payment_context, & invoice ) ;
684
687
expect_recent_payment ! ( david, RecentPaymentDetails :: Fulfilled , payment_id) ;
685
688
}
686
689
@@ -747,7 +750,7 @@ fn creates_and_pays_for_offer_using_one_hop_blinded_path() {
747
750
route_bolt12_payment ( bob, & [ alice] , & invoice) ;
748
751
expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
749
752
750
- claim_bolt12_payment ( bob, & [ alice] , payment_context) ;
753
+ claim_bolt12_payment ( bob, & [ alice] , payment_context, & invoice ) ;
751
754
expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
752
755
}
753
756
@@ -803,7 +806,7 @@ fn creates_and_pays_for_refund_using_one_hop_blinded_path() {
803
806
route_bolt12_payment ( bob, & [ alice] , & invoice) ;
804
807
expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
805
808
806
- claim_bolt12_payment ( bob, & [ alice] , payment_context) ;
809
+ claim_bolt12_payment ( bob, & [ alice] , payment_context, & invoice ) ;
807
810
expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
808
811
}
809
812
@@ -857,7 +860,7 @@ fn pays_for_offer_without_blinded_paths() {
857
860
route_bolt12_payment ( bob, & [ alice] , & invoice) ;
858
861
expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
859
862
860
- claim_bolt12_payment ( bob, & [ alice] , payment_context) ;
863
+ claim_bolt12_payment ( bob, & [ alice] , payment_context, & invoice ) ;
861
864
expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
862
865
}
863
866
@@ -900,7 +903,7 @@ fn pays_for_refund_without_blinded_paths() {
900
903
route_bolt12_payment ( bob, & [ alice] , & invoice) ;
901
904
expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
902
905
903
- claim_bolt12_payment ( bob, & [ alice] , payment_context) ;
906
+ claim_bolt12_payment ( bob, & [ alice] , payment_context, & invoice ) ;
904
907
expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
905
908
}
906
909
@@ -1138,7 +1141,7 @@ fn creates_and_pays_for_offer_with_retry() {
1138
1141
}
1139
1142
route_bolt12_payment ( bob, & [ alice] , & invoice) ;
1140
1143
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 ) ;
1142
1145
expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
1143
1146
}
1144
1147
@@ -1209,7 +1212,7 @@ fn pays_bolt12_invoice_asynchronously() {
1209
1212
route_bolt12_payment ( bob, & [ alice] , & invoice) ;
1210
1213
expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
1211
1214
1212
- claim_bolt12_payment ( bob, & [ alice] , payment_context) ;
1215
+ claim_bolt12_payment ( bob, & [ alice] , payment_context, & invoice ) ;
1213
1216
expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
1214
1217
1215
1218
assert_eq ! (
@@ -1289,7 +1292,7 @@ fn creates_offer_with_blinded_path_using_unannounced_introduction_node() {
1289
1292
route_bolt12_payment ( bob, & [ alice] , & invoice) ;
1290
1293
expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
1291
1294
1292
- claim_bolt12_payment ( bob, & [ alice] , payment_context) ;
1295
+ claim_bolt12_payment ( bob, & [ alice] , payment_context, & invoice ) ;
1293
1296
expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
1294
1297
}
1295
1298
@@ -2145,7 +2148,7 @@ fn fails_paying_invoice_more_than_once() {
2145
2148
assert ! ( david. node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
2146
2149
2147
2150
// 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 ) ;
2149
2152
expect_recent_payment ! ( david, RecentPaymentDetails :: Fulfilled , payment_id) ;
2150
2153
}
2151
2154
@@ -2405,4 +2408,3 @@ fn no_double_pay_with_stale_channelmanager() {
2405
2408
// generated in response to the duplicate invoice.
2406
2409
assert ! ( nodes[ 0 ] . node. get_and_clear_pending_events( ) . is_empty( ) ) ;
2407
2410
}
2408
-
0 commit comments