Skip to content

Commit d6d0359

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 66e0f4b commit d6d0359

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
@@ -2313,15 +2313,17 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
23132313
res
23142314
}
23152315

2316-
fn if_unbroadcasted_funding<F, O>(&self, f: F) -> Option<O>
2317-
where F: Fn() -> Option<O> {
2316+
fn if_unbroadcasted_funding<F, O>(&self, f: F) -> Option<O> where F: Fn() -> Option<O> {
23182317
match self.channel_state {
23192318
ChannelState::FundingNegotiated => f(),
2320-
ChannelState::AwaitingChannelReady(flags) => if flags.is_set(AwaitingChannelReadyFlags::WAITING_FOR_BATCH) {
2321-
f()
2322-
} else {
2323-
None
2324-
},
2319+
ChannelState::AwaitingChannelReady(flags) =>
2320+
if flags.is_set(AwaitingChannelReadyFlags::WAITING_FOR_BATCH) ||
2321+
flags.is_set(FundedStateFlags::MONITOR_UPDATE_IN_PROGRESS.into())
2322+
{
2323+
f()
2324+
} else {
2325+
None
2326+
},
23252327
_ => None,
23262328
}
23272329
}

0 commit comments

Comments
 (0)