@@ -589,6 +589,7 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) {
589
589
590
590
let mut nodes = create_network ( 3 , & node_cfgs, & node_chanmgrs) ;
591
591
592
+ // Because we set nodes[1] to manually accept channels, just open a 0-conf channel.
592
593
let ( funding_tx, chan_id) = open_zero_conf_channel ( & nodes[ 0 ] , & nodes[ 1 ] , None ) ;
593
594
confirm_transaction ( & nodes[ 0 ] , & funding_tx) ;
594
595
confirm_transaction ( & nodes[ 1 ] , & funding_tx) ;
@@ -731,7 +732,7 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) {
731
732
assert_eq ! ( nodes[ 0 ] . node. list_usable_channels( ) . len( ) , 1 ) ;
732
733
733
734
// If we attempt to retry prior to the HTLC-Timeout (or commitment transaction, for dust HTLCs)
734
- // confirming, we will fail as its considered still-pending...
735
+ // confirming, we will fail as it's considered still-pending...
735
736
let ( new_route, _, _, _) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 2 ] , if use_dust { 1_000 } else { 1_000_000 } ) ;
736
737
assert ! ( nodes[ 0 ] . node. retry_payment( & new_route, payment_id) . is_err( ) ) ;
737
738
assert ! ( nodes[ 0 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
@@ -756,7 +757,8 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) {
756
757
reload_node ! ( second_new_chain_monitor, second_nodes_0_deserialized, second_persister) ;
757
758
reconnect_nodes ( & nodes[ 0 ] , & nodes[ 1 ] , ( true , true ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( false , false ) ) ;
758
759
759
- // Now resend the payment, delivering the HTLC through to nodes[1] XXX
760
+ // Now resend the payment, delivering the HTLC and actually claiming it this time. This ensures
761
+ // the payment is not (spuriously) listed as still pending.
760
762
assert ! ( nodes[ 0 ] . node. retry_payment( & new_route, payment_id) . is_ok( ) ) ;
761
763
check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
762
764
pass_along_route ( & nodes[ 0 ] , & [ & [ & nodes[ 1 ] , & nodes[ 2 ] ] ] , if use_dust { 1_000 } else { 1_000_000 } , payment_hash, payment_secret) ;
@@ -771,6 +773,7 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) {
771
773
get_monitor ! ( nodes[ 0 ] , chan_id_3) . write ( & mut chan_1_monitor_serialized) . unwrap ( ) ;
772
774
nodes_0_serialized = nodes[ 0 ] . node . encode ( ) ;
773
775
776
+ // Ensure that after reload we cannot retry the payment.
774
777
reload_node ! ( third_new_chain_monitor, third_nodes_0_deserialized, third_persister) ;
775
778
reconnect_nodes ( & nodes[ 0 ] , & nodes[ 1 ] , ( false , false ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( false , false ) ) ;
776
779
0 commit comments