Skip to content

Commit 7719633

Browse files
committed
Move mpp_failure test to payment_tests.rs
1 parent 38a886b commit 7719633

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

lightning/src/ln/functional_tests.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4099,31 +4099,6 @@ fn test_no_txn_manager_serialize_deserialize() {
40994099
send_payment(&nodes[0], &[&nodes[1]], 1000000);
41004100
}
41014101

4102-
#[test]
4103-
fn mpp_failure() {
4104-
let chanmon_cfgs = create_chanmon_cfgs(4);
4105-
let node_cfgs = create_node_cfgs(4, &chanmon_cfgs);
4106-
let node_chanmgrs = create_node_chanmgrs(4, &node_cfgs, &[None, None, None, None]);
4107-
let nodes = create_network(4, &node_cfgs, &node_chanmgrs);
4108-
4109-
let chan_1_id = create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known()).0.contents.short_channel_id;
4110-
let chan_2_id = create_announced_chan_between_nodes(&nodes, 0, 2, InitFeatures::known(), InitFeatures::known()).0.contents.short_channel_id;
4111-
let chan_3_id = create_announced_chan_between_nodes(&nodes, 1, 3, InitFeatures::known(), InitFeatures::known()).0.contents.short_channel_id;
4112-
let chan_4_id = create_announced_chan_between_nodes(&nodes, 2, 3, InitFeatures::known(), InitFeatures::known()).0.contents.short_channel_id;
4113-
4114-
let (mut route, payment_hash, _, payment_secret) = get_route_and_payment_hash!(&nodes[0], nodes[3], 100000);
4115-
let path = route.paths[0].clone();
4116-
route.paths.push(path);
4117-
route.paths[0][0].pubkey = nodes[1].node.get_our_node_id();
4118-
route.paths[0][0].short_channel_id = chan_1_id;
4119-
route.paths[0][1].short_channel_id = chan_3_id;
4120-
route.paths[1][0].pubkey = nodes[2].node.get_our_node_id();
4121-
route.paths[1][0].short_channel_id = chan_2_id;
4122-
route.paths[1][1].short_channel_id = chan_4_id;
4123-
send_along_route_with_secret(&nodes[0], route, &[&[&nodes[1], &nodes[3]], &[&nodes[2], &nodes[3]]], 200_000, payment_hash, payment_secret);
4124-
fail_payment_along_route(&nodes[0], &[&[&nodes[1], &nodes[3]], &[&nodes[2], &nodes[3]]], false, payment_hash);
4125-
}
4126-
41274102
#[test]
41284103
fn test_dup_htlc_onchain_fails_on_reload() {
41294104
// When a Channel is closed, any outbound HTLCs which were relayed through it are simply

lightning/src/ln/payment_tests.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,31 @@ fn retry_single_path_payment() {
7979
claim_payment_along_route(&nodes[0], &[&[&nodes[1], &nodes[2]]], false, payment_preimage);
8080
}
8181

82+
#[test]
83+
fn mpp_failure() {
84+
let chanmon_cfgs = create_chanmon_cfgs(4);
85+
let node_cfgs = create_node_cfgs(4, &chanmon_cfgs);
86+
let node_chanmgrs = create_node_chanmgrs(4, &node_cfgs, &[None, None, None, None]);
87+
let nodes = create_network(4, &node_cfgs, &node_chanmgrs);
88+
89+
let chan_1_id = create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known()).0.contents.short_channel_id;
90+
let chan_2_id = create_announced_chan_between_nodes(&nodes, 0, 2, InitFeatures::known(), InitFeatures::known()).0.contents.short_channel_id;
91+
let chan_3_id = create_announced_chan_between_nodes(&nodes, 1, 3, InitFeatures::known(), InitFeatures::known()).0.contents.short_channel_id;
92+
let chan_4_id = create_announced_chan_between_nodes(&nodes, 2, 3, InitFeatures::known(), InitFeatures::known()).0.contents.short_channel_id;
93+
94+
let (mut route, payment_hash, _, payment_secret) = get_route_and_payment_hash!(&nodes[0], nodes[3], 100000);
95+
let path = route.paths[0].clone();
96+
route.paths.push(path);
97+
route.paths[0][0].pubkey = nodes[1].node.get_our_node_id();
98+
route.paths[0][0].short_channel_id = chan_1_id;
99+
route.paths[0][1].short_channel_id = chan_3_id;
100+
route.paths[1][0].pubkey = nodes[2].node.get_our_node_id();
101+
route.paths[1][0].short_channel_id = chan_2_id;
102+
route.paths[1][1].short_channel_id = chan_4_id;
103+
send_along_route_with_secret(&nodes[0], route, &[&[&nodes[1], &nodes[3]], &[&nodes[2], &nodes[3]]], 200_000, payment_hash, payment_secret);
104+
fail_payment_along_route(&nodes[0], &[&[&nodes[1], &nodes[3]], &[&nodes[2], &nodes[3]]], false, payment_hash);
105+
}
106+
82107
#[test]
83108
fn mpp_retry() {
84109
let chanmon_cfgs = create_chanmon_cfgs(4);

0 commit comments

Comments
 (0)