From: Chris Waterson Date: Tue, 10 Oct 2023 21:45:44 +0000 (-0700) Subject: Don't return a `channel_ready` event if funding is pending X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=1edde0da6c1948e849ff4ab0c650b4025bc7decd;p=rust-lightning Don't return a `channel_ready` event if funding is pending Per discussion, make it so that `check_get_channel_ready` returns `None` if we're still pending a signature on a funding message. --- diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index ee58674d0..4d88ed3b5 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -4894,6 +4894,12 @@ impl Channel where return None; } + // If we're still pending the signature on a funding transaction, then we're not ready to send a + // channel_ready yet. + if self.context.signer_pending_funding { + return None; + } + // Note that we don't include ChannelState::WaitingForBatch as we don't want to send // channel_ready until the entire batch is ready. let non_shutdown_state = self.context.channel_state & (!MULTI_STATE_FLAGS); @@ -6831,7 +6837,7 @@ impl InboundV1Channel where SP::Target: SignerProvider { context: self.context, }; - let need_channel_ready = funding_signed.is_some() && channel.check_get_channel_ready(0).is_some(); + let need_channel_ready = channel.check_get_channel_ready(0).is_some(); channel.monitor_updating_paused(false, false, need_channel_ready, Vec::new(), Vec::new(), Vec::new()); Ok((channel, funding_signed, channel_monitor))