@@ -7875,70 +7875,6 @@ fn test_manually_reject_inbound_channel_request() {
7875
7875
assert ! ( nodes[ 1 ] . node. get_and_clear_pending_events( ) . is_empty( ) ) ;
7876
7876
}
7877
7877
7878
- #[ignore] // We cannot construct the accept message before creating the IncomingV1Channel object!
7879
- #[test]
7880
- fn test_reject_funding_before_inbound_channel_accepted() {
7881
- // This tests that when `UserConfig::manually_accept_inbound_channels` is set to true, inbound
7882
- // channels must to be manually accepted through `ChannelManager::accept_inbound_channel` by
7883
- // the node operator before the counterparty sends a `FundingCreated` message. If a
7884
- // `FundingCreated` message is received before the channel is accepted, it should be rejected
7885
- // and the channel should be closed.
7886
- let mut manually_accept_conf = UserConfig::default();
7887
- manually_accept_conf.manually_accept_inbound_channels = true;
7888
- let chanmon_cfgs = create_chanmon_cfgs(2);
7889
- let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
7890
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, Some(manually_accept_conf.clone())]);
7891
- let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
7892
-
7893
- nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100000, 10001, 42, Some(manually_accept_conf)).unwrap();
7894
- let res = get_event_msg!(nodes[0], MessageSendEvent::SendOpenChannel, nodes[1].node.get_our_node_id());
7895
- let temp_channel_id = res.temporary_channel_id;
7896
-
7897
- nodes[1].node.handle_open_channel(&nodes[0].node.get_our_node_id(), &res);
7898
-
7899
- // Assert that `nodes[1]` has no `MessageSendEvent::SendAcceptChannel` in the `msg_events`.
7900
- assert!(nodes[1].node.get_and_clear_pending_msg_events().is_empty());
7901
-
7902
- // Clear the `Event::OpenChannelRequest` event without responding to the request.
7903
- nodes[1].node.get_and_clear_pending_events();
7904
-
7905
- // Get the `AcceptChannel` message of `nodes[1]` without calling
7906
- // `ChannelManager::accept_inbound_channel`, which generates a
7907
- // `MessageSendEvent::SendAcceptChannel` event. The message is passed to `nodes[0]`
7908
- // `handle_accept_channel`, which is required in order for `create_funding_transaction` to
7909
- // succeed when `nodes[0]` is passed to it.
7910
- let accept_chan_msg = {
7911
- let mut node_1_per_peer_lock;
7912
- let mut node_1_peer_state_lock;
7913
- let channel = get_inbound_v1_channel_ref!(&nodes[1], nodes[0], node_1_per_peer_lock, node_1_peer_state_lock, temp_channel_id);
7914
- channel.get_accept_channel_message()
7915
- };
7916
- nodes[0].node.handle_accept_channel(&nodes[1].node.get_our_node_id(), &accept_chan_msg);
7917
-
7918
- let (temporary_channel_id, tx, _) = create_funding_transaction(&nodes[0], &nodes[1].node.get_our_node_id(), 100000, 42);
7919
-
7920
- nodes[0].node.funding_transaction_generated(&temporary_channel_id, &nodes[1].node.get_our_node_id(), tx.clone()).unwrap();
7921
- let funding_created_msg = get_event_msg!(nodes[0], MessageSendEvent::SendFundingCreated, nodes[1].node.get_our_node_id());
7922
-
7923
- // The `funding_created_msg` should be rejected by `nodes[1]` as it hasn't accepted the channel
7924
- nodes[1].node.handle_funding_created(&nodes[0].node.get_our_node_id(), &funding_created_msg);
7925
-
7926
- let close_msg_ev = nodes[1].node.get_and_clear_pending_msg_events();
7927
- assert_eq!(close_msg_ev.len(), 1);
7928
-
7929
- let expected_err = "FundingCreated message received before the channel was accepted";
7930
- match close_msg_ev[0] {
7931
- MessageSendEvent::HandleError { action: ErrorAction::SendErrorMessage { ref msg }, ref node_id, } => {
7932
- assert_eq!(msg.channel_id, temp_channel_id);
7933
- assert_eq!(*node_id, nodes[0].node.get_our_node_id());
7934
- assert_eq!(msg.data, expected_err);
7935
- }
7936
- _ => panic!("Unexpected event"),
7937
- }
7938
-
7939
- check_closed_event!(nodes[1], 1, ClosureReason::ProcessingError { err: expected_err.to_string() });
7940
- }
7941
-
7942
7878
#[ test]
7943
7879
fn test_can_not_accept_inbound_channel_twice ( ) {
7944
7880
let mut manually_accept_conf = UserConfig :: default ( ) ;
0 commit comments