Skip to content

Commit 25e3f94

Browse files
committed
Support manual inbound acceptance in channel creation test utils
1 parent 82b646c commit 25e3f94

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lightning/src/ln/functional_test_utils.rs

+9
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,15 @@ pub fn create_chan_between_nodes_with_value_init<'a, 'b, 'c>(node_a: &Node<'a, '
11001100
assert_eq!(open_channel_msg.temporary_channel_id, create_chan_id);
11011101
assert_eq!(node_a.node.list_channels().iter().find(|channel| channel.channel_id == create_chan_id).unwrap().user_channel_id, 42);
11021102
node_b.node.handle_open_channel(&node_a.node.get_our_node_id(), &open_channel_msg);
1103+
if node_b.node.get_current_default_configuration().manually_accept_inbound_channels {
1104+
let events = node_b.node.get_and_clear_pending_events();
1105+
assert_eq!(events.len(), 1);
1106+
match &events[0] {
1107+
Event::OpenChannelRequest { temporary_channel_id, counterparty_node_id, .. } =>
1108+
node_b.node.accept_inbound_channel(temporary_channel_id, counterparty_node_id, 42).unwrap(),
1109+
_ => panic!("Unexpected event"),
1110+
};
1111+
}
11031112
let accept_channel_msg = get_event_msg!(node_b, MessageSendEvent::SendAcceptChannel, node_a.node.get_our_node_id());
11041113
assert_eq!(accept_channel_msg.temporary_channel_id, create_chan_id);
11051114
node_a.node.handle_accept_channel(&node_b.node.get_our_node_id(), &accept_channel_msg);

0 commit comments

Comments
 (0)