@@ -236,55 +236,6 @@ fn mpp_receive_timeout() {
236
236
do_mpp_receive_timeout ( false ) ;
237
237
}
238
238
239
- #[ test]
240
- fn retry_expired_payment ( ) {
241
- let chanmon_cfgs = create_chanmon_cfgs ( 3 ) ;
242
- let node_cfgs = create_node_cfgs ( 3 , & chanmon_cfgs) ;
243
- let node_chanmgrs = create_node_chanmgrs ( 3 , & node_cfgs, & [ None , None , None ] ) ;
244
- let mut nodes = create_network ( 3 , & node_cfgs, & node_chanmgrs) ;
245
-
246
- let _chan_0 = create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
247
- let chan_1 = create_announced_chan_between_nodes ( & nodes, 2 , 1 ) ;
248
- // Rebalance to find a route
249
- send_payment ( & nodes[ 2 ] , & vec ! ( & nodes[ 1 ] ) [ ..] , 3_000_000 ) ;
250
-
251
- let ( route, payment_hash, _, payment_secret) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 2 ] , 100_000 ) ;
252
-
253
- // Rebalance so that the first hop fails.
254
- send_payment ( & nodes[ 1 ] , & vec ! ( & nodes[ 2 ] ) [ ..] , 2_000_000 ) ;
255
-
256
- // Make sure the payment fails on the first hop.
257
- nodes[ 0 ] . node . send_payment ( & route, payment_hash, & Some ( payment_secret) , PaymentId ( payment_hash. 0 ) ) . unwrap ( ) ;
258
- check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
259
- let mut events = nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
260
- assert_eq ! ( events. len( ) , 1 ) ;
261
- let mut payment_event = SendEvent :: from_event ( events. pop ( ) . unwrap ( ) ) ;
262
- nodes[ 1 ] . node . handle_update_add_htlc ( & nodes[ 0 ] . node . get_our_node_id ( ) , & payment_event. msgs [ 0 ] ) ;
263
- check_added_monitors ! ( nodes[ 1 ] , 0 ) ;
264
- commitment_signed_dance ! ( nodes[ 1 ] , nodes[ 0 ] , payment_event. commitment_msg, false ) ;
265
- expect_pending_htlcs_forwardable ! ( nodes[ 1 ] ) ;
266
- expect_pending_htlcs_forwardable_and_htlc_handling_failed ! ( & nodes[ 1 ] , vec![ HTLCDestination :: NextHopChannel { node_id: Some ( nodes[ 2 ] . node. get_our_node_id( ) ) , channel_id: chan_1. 2 } ] ) ;
267
- let htlc_updates = get_htlc_update_msgs ! ( nodes[ 1 ] , nodes[ 0 ] . node. get_our_node_id( ) ) ;
268
- assert ! ( htlc_updates. update_add_htlcs. is_empty( ) ) ;
269
- assert_eq ! ( htlc_updates. update_fail_htlcs. len( ) , 1 ) ;
270
- assert ! ( htlc_updates. update_fulfill_htlcs. is_empty( ) ) ;
271
- assert ! ( htlc_updates. update_fail_malformed_htlcs. is_empty( ) ) ;
272
- check_added_monitors ! ( nodes[ 1 ] , 1 ) ;
273
- nodes[ 0 ] . node . handle_update_fail_htlc ( & nodes[ 1 ] . node . get_our_node_id ( ) , & htlc_updates. update_fail_htlcs [ 0 ] ) ;
274
- commitment_signed_dance ! ( nodes[ 0 ] , nodes[ 1 ] , htlc_updates. commitment_signed, false ) ;
275
- expect_payment_failed ! ( nodes[ 0 ] , payment_hash, false ) ;
276
-
277
- // Mine blocks so the payment will have expired.
278
- connect_blocks ( & nodes[ 0 ] , 3 ) ;
279
-
280
- // Retry the payment and make sure it errors as expected.
281
- if let Err ( PaymentSendFailure :: ParameterError ( APIError :: APIMisuseError { err } ) ) = nodes[ 0 ] . node . retry_payment ( & route, PaymentId ( payment_hash. 0 ) ) {
282
- assert ! ( err. contains( "not found" ) ) ;
283
- } else {
284
- panic ! ( "Unexpected error" ) ;
285
- }
286
- }
287
-
288
239
#[ test]
289
240
fn no_pending_leak_on_initial_send_failure ( ) {
290
241
// In an earlier version of our payment tracking, we'd have a retry entry even when the initial
@@ -618,7 +569,10 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) {
618
569
// If we attempt to retry prior to the HTLC-Timeout (or commitment transaction, for dust HTLCs)
619
570
// confirming, we will fail as it's considered still-pending...
620
571
let ( new_route, _, _, _) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 2 ] , if use_dust { 1_000 } else { 1_000_000 } ) ;
621
- assert ! ( nodes[ 0 ] . node. retry_payment( & new_route, payment_id) . is_err( ) ) ;
572
+ match nodes[ 0 ] . node . send_payment ( & new_route, payment_hash, & Some ( payment_secret) , payment_id) {
573
+ Err ( PaymentSendFailure :: DuplicatePayment ) => { } ,
574
+ _ => panic ! ( "Unexpected error" )
575
+ }
622
576
assert ! ( nodes[ 0 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
623
577
624
578
// After ANTI_REORG_DELAY confirmations, the HTLC should be failed and we can try the payment
@@ -648,7 +602,10 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) {
648
602
pass_along_route ( & nodes[ 0 ] , & [ & [ & nodes[ 1 ] , & nodes[ 2 ] ] ] , if use_dust { 1_000 } else { 1_000_000 } , payment_hash, payment_secret) ;
649
603
claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , payment_preimage) ;
650
604
651
- assert ! ( nodes[ 0 ] . node. send_payment( & new_route, payment_hash, & Some ( payment_secret) , payment_id) . is_err( ) ) ;
605
+ match nodes[ 0 ] . node . send_payment ( & new_route, payment_hash, & Some ( payment_secret) , payment_id) {
606
+ Err ( PaymentSendFailure :: DuplicatePayment ) => { } ,
607
+ _ => panic ! ( "Unexpected error" )
608
+ }
652
609
assert ! ( nodes[ 0 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
653
610
654
611
let chan_0_monitor_serialized = get_monitor ! ( nodes[ 0 ] , chan_id) . encode ( ) ;
@@ -662,7 +619,10 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) {
662
619
663
620
reconnect_nodes ( & nodes[ 0 ] , & nodes[ 1 ] , ( false , false ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( false , false ) ) ;
664
621
665
- assert ! ( nodes[ 0 ] . node. retry_payment( & new_route, payment_id) . is_err( ) ) ;
622
+ match nodes[ 0 ] . node . send_payment ( & new_route, payment_hash, & Some ( payment_secret) , payment_id) {
623
+ Err ( PaymentSendFailure :: DuplicatePayment ) => { } ,
624
+ _ => panic ! ( "Unexpected error" )
625
+ }
666
626
assert ! ( nodes[ 0 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
667
627
}
668
628
0 commit comments