Skip to content

Commit 541a54a

Browse files
committed
f maybe fix tests on ci?
1 parent 44e2fb4 commit 541a54a

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

lightning/src/ln/chanmon_update_fail_tests.rs

+24-6
Original file line numberDiff line numberDiff line change
@@ -3951,14 +3951,15 @@ fn test_single_channel_multiple_mpp() {
39513951
let thrd3 = std::thread::spawn(move || {
39523952
std::thread::sleep(MAX_THREAD_INIT_TIME);
39533953
do_a_write_background.send(()).unwrap();
3954+
std::thread::sleep(MAX_THREAD_INIT_TIME);
3955+
do_a_write_background.send(()).unwrap();
39543956
});
39553957
nodes[6].node.handle_revoke_and_ack(node_5_id, &raa);
39563958
thrd3.join().unwrap();
39573959

39583960
let thrd4 = std::thread::spawn(move || {
39593961
std::thread::sleep(MAX_THREAD_INIT_TIME);
39603962
do_a_write.send(()).unwrap();
3961-
do_a_write.send(()).unwrap();
39623963
});
39633964

39643965
thrd4.join().unwrap();
@@ -3978,11 +3979,19 @@ fn test_single_channel_multiple_mpp() {
39783979
let (updates, raa) = get_updates_and_revoke(&nodes[6], &nodes[5].node.get_our_node_id());
39793980
nodes[5].node.handle_update_fulfill_htlc(node_6_id, &updates.update_fulfill_htlcs[0]);
39803981
expect_payment_forwarded!(nodes[5], nodes[2], nodes[6], Some(1000), false, false);
3981-
nodes[5].node.handle_update_fulfill_htlc(node_6_id, &updates.update_fulfill_htlcs[1]);
3982-
expect_payment_forwarded!(nodes[5], nodes[3], nodes[6], Some(1000), false, false);
3982+
let mut next_from = 3;
3983+
if let Some(update) = updates.update_fulfill_htlcs.get(1) {
3984+
nodes[5].node.handle_update_fulfill_htlc(node_6_id, update);
3985+
expect_payment_forwarded!(nodes[5], nodes[next_from], nodes[6], Some(1000), false, false);
3986+
next_from += 1;
3987+
}
39833988
nodes[5].node.handle_commitment_signed(node_6_id, &updates.commitment_signed);
39843989
nodes[5].node.handle_revoke_and_ack(node_6_id, &raa);
3985-
check_added_monitors(&nodes[5], 4);
3990+
if updates.update_fulfill_htlcs.get(1).is_some() {
3991+
check_added_monitors(&nodes[5], 4);
3992+
} else {
3993+
check_added_monitors(&nodes[5], 3);
3994+
}
39863995

39873996
let (raa, cs) = get_revoke_commit_msgs(&nodes[5], &node_6_id);
39883997

@@ -3992,10 +4001,19 @@ fn test_single_channel_multiple_mpp() {
39924001

39934002
let (updates, raa) = get_updates_and_revoke(&nodes[6], &nodes[5].node.get_our_node_id());
39944003
nodes[5].node.handle_update_fulfill_htlc(node_6_id, &updates.update_fulfill_htlcs[0]);
3995-
expect_payment_forwarded!(nodes[5], nodes[4], nodes[6], Some(1000), false, false);
4004+
expect_payment_forwarded!(nodes[5], nodes[next_from], nodes[6], Some(1000), false, false);
4005+
next_from += 1;
4006+
if let Some(update) = updates.update_fulfill_htlcs.get(1) {
4007+
nodes[5].node.handle_update_fulfill_htlc(node_6_id, update);
4008+
expect_payment_forwarded!(nodes[5], nodes[next_from], nodes[6], Some(1000), false, false);
4009+
}
39964010
nodes[5].node.handle_commitment_signed(node_6_id, &updates.commitment_signed);
39974011
nodes[5].node.handle_revoke_and_ack(node_6_id, &raa);
3998-
check_added_monitors(&nodes[5], 3);
4012+
if updates.update_fulfill_htlcs.get(1).is_some() {
4013+
check_added_monitors(&nodes[5], 4);
4014+
} else {
4015+
check_added_monitors(&nodes[5], 3);
4016+
}
39994017

40004018
let (raa, cs) = get_revoke_commit_msgs(&nodes[5], &node_6_id);
40014019
nodes[6].node.handle_revoke_and_ack(node_5_id, &raa);

0 commit comments

Comments
 (0)