@@ -589,12 +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
- let ( funding_tx, chan_id) = open_zero_conf_channel ( & nodes[ 0 ] , & nodes[ 1 ] , None ) ;
593
- confirm_transaction ( & nodes[ 0 ] , & funding_tx) ;
594
- confirm_transaction ( & nodes[ 1 ] , & funding_tx) ;
595
- // Ignore the announcement_signatures messages
596
- nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
597
- nodes[ 1 ] . node . get_and_clear_pending_msg_events ( ) ;
592
+ let ( _, funding_tx, chan_id, ..) = create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
598
593
let chan_id_2 = create_announced_chan_between_nodes ( & nodes, 1 , 2 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) . 2 ;
599
594
600
595
// Serialize the ChannelManager prior to sending payments
@@ -731,7 +726,7 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) {
731
726
assert_eq ! ( nodes[ 0 ] . node. list_usable_channels( ) . len( ) , 1 ) ;
732
727
733
728
// 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...
729
+ // confirming, we will fail as it's considered still-pending...
735
730
let ( new_route, _, _, _) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 2 ] , if use_dust { 1_000 } else { 1_000_000 } ) ;
736
731
assert ! ( nodes[ 0 ] . node. retry_payment( & new_route, payment_id) . is_err( ) ) ;
737
732
assert ! ( nodes[ 0 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
@@ -756,7 +751,8 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) {
756
751
reload_node ! ( second_new_chain_monitor, second_nodes_0_deserialized, second_persister) ;
757
752
reconnect_nodes ( & nodes[ 0 ] , & nodes[ 1 ] , ( true , true ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( false , false ) ) ;
758
753
759
- // Now resend the payment, delivering the HTLC through to nodes[1] XXX
754
+ // Now resend the payment, delivering the HTLC and actually claiming it this time. This ensures
755
+ // the payment is not (spuriously) listed as still pending.
760
756
assert ! ( nodes[ 0 ] . node. retry_payment( & new_route, payment_id) . is_ok( ) ) ;
761
757
check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
762
758
pass_along_route ( & nodes[ 0 ] , & [ & [ & nodes[ 1 ] , & nodes[ 2 ] ] ] , if use_dust { 1_000 } else { 1_000_000 } , payment_hash, payment_secret) ;
@@ -771,6 +767,7 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) {
771
767
get_monitor ! ( nodes[ 0 ] , chan_id_3) . write ( & mut chan_1_monitor_serialized) . unwrap ( ) ;
772
768
nodes_0_serialized = nodes[ 0 ] . node . encode ( ) ;
773
769
770
+ // Ensure that after reload we cannot retry the payment.
774
771
reload_node ! ( third_new_chain_monitor, third_nodes_0_deserialized, third_persister) ;
775
772
reconnect_nodes ( & nodes[ 0 ] , & nodes[ 1 ] , ( false , false ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( false , false ) ) ;
776
773
0 commit comments