Skip to content

Commit 0bfa5ef

Browse files
wip
1 parent c7c1a5f commit 0bfa5ef

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

lightning/src/ln/functional_test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ pub fn create_chan_between_nodes_with_value_b<'a, 'b, 'c>(node_a: &Node<'a, 'b,
939939
}
940940

941941
pub fn create_announced_chan_between_nodes<'a, 'b, 'c, 'd>(nodes: &'a Vec<Node<'b, 'c, 'd>>, a: usize, b: usize, a_flags: InitFeatures, b_flags: InitFeatures) -> (msgs::ChannelUpdate, msgs::ChannelUpdate, [u8; 32], Transaction) {
942-
create_announced_chan_between_nodes_with_value(nodes, a, b, 100000, 10001, a_flags, b_flags)
942+
create_announced_chan_between_nodes_with_value(nodes, a, b, 100_000, 10_001, a_flags, b_flags)
943943
}
944944

945945
pub fn create_announced_chan_between_nodes_with_value<'a, 'b, 'c, 'd>(nodes: &'a Vec<Node<'b, 'c, 'd>>, a: usize, b: usize, channel_value: u64, push_msat: u64, a_flags: InitFeatures, b_flags: InitFeatures) -> (msgs::ChannelUpdate, msgs::ChannelUpdate, [u8; 32], Transaction) {

lightning/src/ln/payment_tests.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,3 +1758,26 @@ fn do_automatic_retries(test: AutoRetry) {
17581758
}
17591759
}
17601760
}
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

Comments
 (0)