Skip to content

Commit 396c36b

Browse files
committed
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.
1 parent 4deb263 commit 396c36b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lightning/src/ln/channel.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2316,15 +2316,17 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
23162316
res
23172317
}
23182318

2319-
fn if_unbroadcasted_funding<F, O>(&self, f: F) -> Option<O>
2320-
where F: Fn() -> Option<O> {
2319+
fn if_unbroadcasted_funding<F, O>(&self, f: F) -> Option<O> where F: Fn() -> Option<O> {
23212320
match self.channel_state {
23222321
ChannelState::FundingNegotiated => f(),
2323-
ChannelState::AwaitingChannelReady(flags) => if flags.is_set(AwaitingChannelReadyFlags::WAITING_FOR_BATCH) {
2324-
f()
2325-
} else {
2326-
None
2327-
},
2322+
ChannelState::AwaitingChannelReady(flags) =>
2323+
if flags.is_set(AwaitingChannelReadyFlags::WAITING_FOR_BATCH) ||
2324+
flags.is_set(FundedStateFlags::MONITOR_UPDATE_IN_PROGRESS.into())
2325+
{
2326+
f()
2327+
} else {
2328+
None
2329+
},
23282330
_ => None,
23292331
}
23302332
}

0 commit comments

Comments
 (0)