X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fchannel.rs;h=f50865dc4af22044d9eaabedf560c1da845d98b4;hb=70ae45fea030ed1d2064918c7b023aa142387bc8;hp=a168177fd0553d534cb7a894a6cbcc8c5a672a6e;hpb=ec7ccf0415d665441d74edbc479fb9ad357c2751;p=rust-lightning diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index a168177f..f50865dc 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -4667,9 +4667,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 };