X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fchannel.rs;h=9737738afb5ae653cf63b035820a9740a674392b;hb=13b7cd503bd27981b249fabcaa4f2a12601f648b;hp=4daaf630ac4e57bd7c96ed73e401badf986236d1;hpb=8e5cf757717398bb8a3dd83dd751c8065ac5aebe;p=rust-lightning diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index 4daaf630..9737738a 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -4658,9 +4658,17 @@ impl Channel { } else if non_shutdown_state == (ChannelState::FundingSent as u32 | ChannelState::OurChannelReady as u32) { // We got a reorg but not enough to trigger a force close, just ignore. false - } else if self.channel_state < ChannelState::ChannelFunded as u32 { - panic!("Started confirming a channel in a state pre-FundingSent?: {}", self.channel_state); } else { + if self.channel_state < ChannelState::ChannelFunded as u32 { + // We should never see a funding transaction on-chain until we've received + // funding_signed (if we're an outbound channel), or seen funding_generated (if we're + // an inbound channel - before that we have no known funding TXID). The fuzzer, + // however, may do this and we shouldn't treat it as a bug. + #[cfg(not(fuzzing))] + panic!("Started confirming a channel in a state pre-FundingSent: {}.\n\ + Do NOT broadcast a funding transaction manually - let LDK do it for you!", + self.channel_state); + } // We got a reorg but not enough to trigger a force close, just ignore. false };