Skip to content

Commit 6e00c28

Browse files
Merge pull request #1513 from TheBlueMatt/2022-06-fix-fuzz-nonbug
Do not panic on early tx broadcasts in fuzzing
2 parents 7adf2c7 + 47045b0 commit 6e00c28

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lightning/src/ln/channel.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -4658,9 +4658,17 @@ impl<Signer: Sign> Channel<Signer> {
46584658
} else if non_shutdown_state == (ChannelState::FundingSent as u32 | ChannelState::OurChannelReady as u32) {
46594659
// We got a reorg but not enough to trigger a force close, just ignore.
46604660
false
4661-
} else if self.channel_state < ChannelState::ChannelFunded as u32 {
4662-
panic!("Started confirming a channel in a state pre-FundingSent?: {}", self.channel_state);
46634661
} else {
4662+
if self.channel_state < ChannelState::ChannelFunded as u32 {
4663+
// We should never see a funding transaction on-chain until we've received
4664+
// funding_signed (if we're an outbound channel), or seen funding_generated (if we're
4665+
// an inbound channel - before that we have no known funding TXID). The fuzzer,
4666+
// however, may do this and we shouldn't treat it as a bug.
4667+
#[cfg(not(fuzzing))]
4668+
panic!("Started confirming a channel in a state pre-FundingSent: {}.\n\
4669+
Do NOT broadcast a funding transaction manually - let LDK do it for you!",
4670+
self.channel_state);
4671+
}
46644672
// We got a reorg but not enough to trigger a force close, just ignore.
46654673
false
46664674
};

0 commit comments

Comments
 (0)