From fbb36a07696317362cfdb46aa4c6f67eb279afef Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sun, 4 Jul 2021 14:13:45 +0000 Subject: [PATCH] Reject minimum_depth of 0 on channel opens We don't support turbo channels so this is a pretty clear indication that there is some incompatibility. --- lightning/src/ln/channel.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index 4051ebf3..a39e453c 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -1488,6 +1488,12 @@ impl Channel { if msg.minimum_depth > config.peer_channel_config_limits.max_minimum_depth { return Err(ChannelError::Close(format!("We consider the minimum depth to be unreasonably large. Expected minimum: ({}). Actual: ({})", config.peer_channel_config_limits.max_minimum_depth, msg.minimum_depth))); } + if msg.minimum_depth == 0 { + // Note that if this changes we should update the serialization minimum version to + // indicate to older clients that they don't understand some features of the current + // channel. + return Err(ChannelError::Close("Minimum confirmation depth must be at least 1".to_owned())); + } let counterparty_shutdown_scriptpubkey = if their_features.supports_upfront_shutdown_script() { match &msg.shutdown_scriptpubkey { -- 2.30.2