Add 'accept_inbound_channels' config option.
[rust-lightning] / lightning / src / ln / channelmanager.rs
index 9e0fc3ebb5e599ef4bde11671f2befcd13e26e86..1e60dcdccd401538cf4b2210b030024818e2ef17 100644 (file)
@@ -3646,6 +3646,10 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> 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))?;