Skip to content

Commit 010c34f

Browse files
committed
Fix what bolt2_open_channel_sending_node_checks_part1 tests
There are currently two issues with `bolt2_open_channel_sending_node_checks_part1` which counteract each other and hide that the test isn't testing what it should be. First of all, the final `create_channel` call actually fails because we try to open a channel with ourselves, instead of panicing as the test is supposed to check for. However, when we fix the create_channel call to panic, when we drop `nodes[1]` after `create_channel` panics, we fail the no-pending-messages test as it as an expeted `accept_channel` in its outbound buffer. This causes a double-panic. Previously, these two offset each other - instead of panicing in `create_channel` we'd panic in the Node drop checks. This fixes both by fetching the `accept_channel` before we go into the panic'ing `create_channel` call (who's arguments were corrected).
1 parent 6259e7a commit 010c34f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lightning/src/ln/functional_tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6010,9 +6010,10 @@ fn bolt2_open_channel_sending_node_checks_part1() { //This test needs to be on i
60106010
nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), channel_value_satoshis, push_msat, 42, None).unwrap();
60116011
let node0_to_1_send_open_channel = get_event_msg!(nodes[0], MessageSendEvent::SendOpenChannel, nodes[1].node.get_our_node_id());
60126012
nodes[1].node.handle_open_channel(&nodes[0].node.get_our_node_id(), InitFeatures::known(), &node0_to_1_send_open_channel);
6013+
get_event_msg!(nodes[1], MessageSendEvent::SendAcceptChannel, nodes[0].node.get_our_node_id());
60136014

60146015
//Create a second channel with a channel_id collision
6015-
assert!(nodes[0].node.create_channel(nodes[0].node.get_our_node_id(), channel_value_satoshis, push_msat, 42, None).is_err());
6016+
assert!(nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), channel_value_satoshis, push_msat, 42, None).is_err());
60166017
}
60176018

60186019
#[test]

0 commit comments

Comments
 (0)