Skip to content

Commit 8d886ee

Browse files
authored
Merge pull request #1173 from tnull/add_accept_inbound_channels_option
Add 'accept_inbound_channels' config option.
2 parents 2b4ca9e + e7b2bca commit 8d886ee

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lightning/src/ln/channelmanager.rs

+4
Original file line numberDiff line numberDiff line change
@@ -3646,6 +3646,10 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
36463646
return Err(MsgHandleErrInternal::send_err_msg_no_close("Unknown genesis block hash".to_owned(), msg.temporary_channel_id.clone()));
36473647
}
36483648

3649+
if !self.default_configuration.accept_inbound_channels {
3650+
return Err(MsgHandleErrInternal::send_err_msg_no_close("No inbound channels accepted".to_owned(), msg.temporary_channel_id.clone()));
3651+
}
3652+
36493653
let channel = Channel::new_from_req(&self.fee_estimator, &self.keys_manager, counterparty_node_id.clone(),
36503654
&their_features, msg, 0, &self.default_configuration, self.best_block.read().unwrap().height())
36513655
.map_err(|e| MsgHandleErrInternal::from_chan_no_close(e, msg.temporary_channel_id))?;

lightning/src/util/config.rs

+4
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@ pub struct UserConfig {
302302
///
303303
/// Default value: false.
304304
pub accept_forwards_to_priv_channels: bool,
305+
/// If this is set to false, we do not accept inbound requests to open a new channel.
306+
/// Default value: true.
307+
pub accept_inbound_channels: bool,
305308
}
306309

307310
impl Default for UserConfig {
@@ -311,6 +314,7 @@ impl Default for UserConfig {
311314
peer_channel_config_limits: ChannelHandshakeLimits::default(),
312315
channel_options: ChannelConfig::default(),
313316
accept_forwards_to_priv_channels: false,
317+
accept_inbound_channels: true,
314318
}
315319
}
316320
}

0 commit comments

Comments
 (0)