@@ -589,6 +589,7 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) {
589589
590590 let mut nodes = create_network ( 3 , & node_cfgs, & node_chanmgrs) ;
591591
592+ // Because we set nodes[1] to manually accept channels, just open a 0-conf channel.
592593 let ( funding_tx, chan_id) = open_zero_conf_channel ( & nodes[ 0 ] , & nodes[ 1 ] , None ) ;
593594 confirm_transaction ( & nodes[ 0 ] , & funding_tx) ;
594595 confirm_transaction ( & nodes[ 1 ] , & funding_tx) ;
@@ -731,7 +732,7 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) {
731732 assert_eq ! ( nodes[ 0 ] . node. list_usable_channels( ) . len( ) , 1 ) ;
732733
733734 // 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...
735736 let ( new_route, _, _, _) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 2 ] , if use_dust { 1_000 } else { 1_000_000 } ) ;
736737 assert ! ( nodes[ 0 ] . node. retry_payment( & new_route, payment_id) . is_err( ) ) ;
737738 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) {
756757 reload_node ! ( second_new_chain_monitor, second_nodes_0_deserialized, second_persister) ;
757758 reconnect_nodes ( & nodes[ 0 ] , & nodes[ 1 ] , ( true , true ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( false , false ) ) ;
758759
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.
760762 assert ! ( nodes[ 0 ] . node. retry_payment( & new_route, payment_id) . is_ok( ) ) ;
761763 check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
762764 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) {
771773 get_monitor ! ( nodes[ 0 ] , chan_id_3) . write ( & mut chan_1_monitor_serialized) . unwrap ( ) ;
772774 nodes_0_serialized = nodes[ 0 ] . node . encode ( ) ;
773775
776+ // Ensure that after reload we cannot retry the payment.
774777 reload_node ! ( third_new_chain_monitor, third_nodes_0_deserialized, third_persister) ;
775778 reconnect_nodes ( & nodes[ 0 ] , & nodes[ 1 ] , ( false , false ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( false , false ) ) ;
776779
0 commit comments