@@ -1758,3 +1758,26 @@ fn do_automatic_retries(test: AutoRetry) {
1758
1758
}
1759
1759
}
1760
1760
}
1761
+
1762
+ #[ test]
1763
+ fn auto_retry_partial_failure ( ) {
1764
+ // Test that we'll retry appropriately on send partial failure and retry partial failure.
1765
+ let chanmon_cfgs = create_chanmon_cfgs ( 4 ) ;
1766
+ let node_cfgs = create_node_cfgs ( 4 , & chanmon_cfgs) ;
1767
+ let node_chanmgrs = create_node_chanmgrs ( 4 , & node_cfgs, & [ None , None , None , None ] ) ;
1768
+ let mut nodes = create_network ( 4 , & node_cfgs, & node_chanmgrs) ;
1769
+
1770
+ let chan_1_id = create_announced_chan_between_nodes ( & nodes, 0 , 1 , channelmanager:: provided_init_features ( ) , channelmanager:: provided_init_features ( ) ) . 0 . contents . short_channel_id ;
1771
+ let ( chan_2_ann, _, chan_2_id, _) = create_announced_chan_between_nodes ( & nodes, 0 , 2 , channelmanager:: provided_init_features ( ) , channelmanager:: provided_init_features ( ) ) ;
1772
+ let chan_3_id = create_announced_chan_between_nodes ( & nodes, 1 , 3 , channelmanager:: provided_init_features ( ) , channelmanager:: provided_init_features ( ) ) . 0 . contents . short_channel_id ;
1773
+ let chan_4_id = create_announced_chan_between_nodes ( & nodes, 2 , 3 , channelmanager:: provided_init_features ( ) , channelmanager:: provided_init_features ( ) ) . 0 . contents . short_channel_id ;
1774
+
1775
+ // This amount should force the router to split across nodes[0]'s two channels.
1776
+ let amt_msat = 18_000_000 ;
1777
+ let ( _, payment_hash, payment_preimage, payment_secret) = get_route_and_payment_hash ! ( & nodes[ 0 ] , nodes[ 3 ] , amt_msat) ;
1778
+
1779
+ // Set it so that the first monitor update (for the path 0 -> 1 -> 3) succeeds, but the second
1780
+ // (for the path 0 -> 2 -> 3) fails.
1781
+ chanmon_cfgs[ 0 ] . persister . set_update_ret ( ChannelMonitorUpdateStatus :: Completed ) ;
1782
+ chanmon_cfgs[ 0 ] . persister . set_next_update_ret ( Some ( ChannelMonitorUpdateStatus :: InProgress ) ) ;
1783
+ }
0 commit comments