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