From: Elias Rohrer Date: Wed, 17 Nov 2021 17:54:47 +0000 (+0100) Subject: Add 'accept_inbound_channels' config option. X-Git-Tag: v0.0.104~32^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=e7b2bca1d6b58ff9e2ccc3c0ca7d3c9afadb67e2;p=rust-lightning Add 'accept_inbound_channels' config option. --- diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 9e0fc3ebb..1e60dcdcc 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -3646,6 +3646,10 @@ impl ChannelMana return Err(MsgHandleErrInternal::send_err_msg_no_close("Unknown genesis block hash".to_owned(), msg.temporary_channel_id.clone())); } + if !self.default_configuration.accept_inbound_channels { + return Err(MsgHandleErrInternal::send_err_msg_no_close("No inbound channels accepted".to_owned(), msg.temporary_channel_id.clone())); + } + let channel = Channel::new_from_req(&self.fee_estimator, &self.keys_manager, counterparty_node_id.clone(), &their_features, msg, 0, &self.default_configuration, self.best_block.read().unwrap().height()) .map_err(|e| MsgHandleErrInternal::from_chan_no_close(e, msg.temporary_channel_id))?; diff --git a/lightning/src/util/config.rs b/lightning/src/util/config.rs index fb4f6fce7..c591cacb3 100644 --- a/lightning/src/util/config.rs +++ b/lightning/src/util/config.rs @@ -302,6 +302,9 @@ pub struct UserConfig { /// /// Default value: false. pub accept_forwards_to_priv_channels: bool, + /// If this is set to false, we do not accept inbound requests to open a new channel. + /// Default value: true. + pub accept_inbound_channels: bool, } impl Default for UserConfig { @@ -311,6 +314,7 @@ impl Default for UserConfig { peer_channel_config_limits: ChannelHandshakeLimits::default(), channel_options: ChannelConfig::default(), accept_forwards_to_priv_channels: false, + accept_inbound_channels: true, } } }