]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Don't return a `channel_ready` event if funding is pending
authorChris Waterson <waterson@gmail.com>
Tue, 10 Oct 2023 21:45:44 +0000 (14:45 -0700)
committerChris Waterson <waterson@gmail.com>
Wed, 25 Oct 2023 16:26:34 +0000 (09:26 -0700)
Per discussion, make it so that `check_get_channel_ready` returns `None` if
we're still pending a signature on a funding message.

lightning/src/ln/channel.rs

index ee58674d05a9cc6eec17b36461be0a19e66f424e..4d88ed3b5782cfcc11cc52ccd7d88e6910a6126d 100644 (file)
@@ -4894,6 +4894,12 @@ impl<SP: Deref> Channel<SP> 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<SP: Deref> InboundV1Channel<SP> 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))