@@ -228,55 +228,6 @@ fn mpp_receive_timeout() {
228
228
do_mpp_receive_timeout ( false ) ;
229
229
}
230
230
231
- #[ test]
232
- fn retry_expired_payment ( ) {
233
- let chanmon_cfgs = create_chanmon_cfgs ( 3 ) ;
234
- let node_cfgs = create_node_cfgs ( 3 , & chanmon_cfgs) ;
235
- let node_chanmgrs = create_node_chanmgrs ( 3 , & node_cfgs, & [ None , None , None ] ) ;
236
- let mut nodes = create_network ( 3 , & node_cfgs, & node_chanmgrs) ;
237
-
238
- let _chan_0 = create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
239
- let chan_1 = create_announced_chan_between_nodes ( & nodes, 2 , 1 ) ;
240
- // Rebalance to find a route
241
- send_payment ( & nodes[ 2 ] , & vec ! ( & nodes[ 1 ] ) [ ..] , 3_000_000 ) ;
242
-
243
- let ( route, payment_hash, _, payment_secret) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 2 ] , 100_000 ) ;
244
-
245
- // Rebalance so that the first hop fails.
246
- send_payment ( & nodes[ 1 ] , & vec ! ( & nodes[ 2 ] ) [ ..] , 2_000_000 ) ;
247
-
248
- // Make sure the payment fails on the first hop.
249
- nodes[ 0 ] . node . send_payment ( & route, payment_hash, & Some ( payment_secret) , PaymentId ( payment_hash. 0 ) ) . unwrap ( ) ;
250
- check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
251
- let mut events = nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
252
- assert_eq ! ( events. len( ) , 1 ) ;
253
- let mut payment_event = SendEvent :: from_event ( events. pop ( ) . unwrap ( ) ) ;
254
- nodes[ 1 ] . node . handle_update_add_htlc ( & nodes[ 0 ] . node . get_our_node_id ( ) , & payment_event. msgs [ 0 ] ) ;
255
- check_added_monitors ! ( nodes[ 1 ] , 0 ) ;
256
- commitment_signed_dance ! ( nodes[ 1 ] , nodes[ 0 ] , payment_event. commitment_msg, false ) ;
257
- expect_pending_htlcs_forwardable ! ( nodes[ 1 ] ) ;
258
- 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 } ] ) ;
259
- let htlc_updates = get_htlc_update_msgs ! ( nodes[ 1 ] , nodes[ 0 ] . node. get_our_node_id( ) ) ;
260
- assert ! ( htlc_updates. update_add_htlcs. is_empty( ) ) ;
261
- assert_eq ! ( htlc_updates. update_fail_htlcs. len( ) , 1 ) ;
262
- assert ! ( htlc_updates. update_fulfill_htlcs. is_empty( ) ) ;
263
- assert ! ( htlc_updates. update_fail_malformed_htlcs. is_empty( ) ) ;
264
- check_added_monitors ! ( nodes[ 1 ] , 1 ) ;
265
- nodes[ 0 ] . node . handle_update_fail_htlc ( & nodes[ 1 ] . node . get_our_node_id ( ) , & htlc_updates. update_fail_htlcs [ 0 ] ) ;
266
- commitment_signed_dance ! ( nodes[ 0 ] , nodes[ 1 ] , htlc_updates. commitment_signed, false ) ;
267
- expect_payment_failed ! ( nodes[ 0 ] , payment_hash, false ) ;
268
-
269
- // Mine blocks so the payment will have expired.
270
- connect_blocks ( & nodes[ 0 ] , 3 ) ;
271
-
272
- // Retry the payment and make sure it errors as expected.
273
- if let Err ( PaymentSendFailure :: ParameterError ( APIError :: APIMisuseError { err } ) ) = nodes[ 0 ] . node . retry_payment ( & route, PaymentId ( payment_hash. 0 ) ) {
274
- assert ! ( err. contains( "not found" ) ) ;
275
- } else {
276
- panic ! ( "Unexpected error" ) ;
277
- }
278
- }
279
-
280
231
#[ test]
281
232
fn no_pending_leak_on_initial_send_failure ( ) {
282
233
// In an earlier version of our payment tracking, we'd have a retry entry even when the initial
@@ -570,7 +521,10 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) {
570
521
// If we attempt to retry prior to the HTLC-Timeout (or commitment transaction, for dust HTLCs)
571
522
// confirming, we will fail as it's considered still-pending...
572
523
let ( new_route, _, _, _) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 2 ] , if use_dust { 1_000 } else { 1_000_000 } ) ;
573
- assert ! ( nodes[ 0 ] . node. retry_payment( & new_route, payment_id) . is_err( ) ) ;
524
+ match nodes[ 0 ] . node . send_payment ( & new_route, payment_hash, & Some ( payment_secret) , payment_id) {
525
+ Err ( PaymentSendFailure :: DuplicatePayment ) => { } ,
526
+ _ => panic ! ( "Unexpected error" )
527
+ }
574
528
assert ! ( nodes[ 0 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
575
529
576
530
// After ANTI_REORG_DELAY confirmations, the HTLC should be failed and we can try the payment
@@ -600,7 +554,10 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) {
600
554
pass_along_route ( & nodes[ 0 ] , & [ & [ & nodes[ 1 ] , & nodes[ 2 ] ] ] , if use_dust { 1_000 } else { 1_000_000 } , payment_hash, payment_secret) ;
601
555
claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , payment_preimage) ;
602
556
603
- assert ! ( nodes[ 0 ] . node. send_payment( & new_route, payment_hash, & Some ( payment_secret) , payment_id) . is_err( ) ) ;
557
+ match nodes[ 0 ] . node . send_payment ( & new_route, payment_hash, & Some ( payment_secret) , payment_id) {
558
+ Err ( PaymentSendFailure :: DuplicatePayment ) => { } ,
559
+ _ => panic ! ( "Unexpected error" )
560
+ }
604
561
assert ! ( nodes[ 0 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
605
562
606
563
let chan_0_monitor_serialized = get_monitor ! ( nodes[ 0 ] , chan_id) . encode ( ) ;
@@ -614,7 +571,10 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) {
614
571
615
572
reconnect_nodes ( & nodes[ 0 ] , & nodes[ 1 ] , ( false , false ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( false , false ) ) ;
616
573
617
- assert ! ( nodes[ 0 ] . node. retry_payment( & new_route, payment_id) . is_err( ) ) ;
574
+ match nodes[ 0 ] . node . send_payment ( & new_route, payment_hash, & Some ( payment_secret) , payment_id) {
575
+ Err ( PaymentSendFailure :: DuplicatePayment ) => { } ,
576
+ _ => panic ! ( "Unexpected error" )
577
+ }
618
578
assert ! ( nodes[ 0 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
619
579
}
620
580
0 commit comments