From: Matt Corallo Date: Fri, 29 Dec 2023 00:45:07 +0000 (+0000) Subject: Consider `MONITOR_UPDATE_IN_PROGRESS` as unbroadcasted funding X-Git-Tag: v0.0.120~13^2~5 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=396c36b6ea2335acabd297eb7ed1acaac69a80ea;p=rust-lightning Consider `MONITOR_UPDATE_IN_PROGRESS` as unbroadcasted funding If we promote our channel to `AwaitingChannelReady` after adding funding info, but still have `MONITOR_UPDATE_IN_PROGRESS` set, we haven't broadcasted the funding transaction yet and thus should return values from `unbroadcasted_funding[_txid]` and generate a `DiscardFunding` event. --- diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index 588995656..1f50c7614 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -2316,15 +2316,17 @@ impl ChannelContext where SP::Target: SignerProvider { res } - fn if_unbroadcasted_funding(&self, f: F) -> Option - where F: Fn() -> Option { + fn if_unbroadcasted_funding(&self, f: F) -> Option where F: Fn() -> Option { match self.channel_state { ChannelState::FundingNegotiated => f(), - ChannelState::AwaitingChannelReady(flags) => if flags.is_set(AwaitingChannelReadyFlags::WAITING_FOR_BATCH) { - f() - } else { - None - }, + ChannelState::AwaitingChannelReady(flags) => + if flags.is_set(AwaitingChannelReadyFlags::WAITING_FOR_BATCH) || + flags.is_set(FundedStateFlags::MONITOR_UPDATE_IN_PROGRESS.into()) + { + f() + } else { + None + }, _ => None, } }