From: Matt Corallo Date: Sun, 4 Jul 2021 14:13:45 +0000 (+0000) Subject: Reject minimum_depth of 0 on channel opens X-Git-Tag: v0.0.99~5^2~5 X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=rust-lightning;a=commitdiff_plain;h=fbb36a07696317362cfdb46aa4c6f67eb279afef 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. --- 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 {