X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fchannel.rs;h=c8209a9eac6f984f76514987729d9ca04dde192f;hb=d2a9ae0b8eb5bdb1724be0b8d398d0fdf9870266;hp=624f4d6b688b0e2d81964d39e2deb77e1233af8a;hpb=11166aa83623c7e80015d50dbfc9fc8529f969a2;p=rust-lightning diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index 624f4d6b..c8209a9e 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -3550,6 +3550,12 @@ impl Channel { return; } + if self.channel_state & (ChannelState::PeerDisconnected as u32) == (ChannelState::PeerDisconnected as u32) { + // While the below code should be idempotent, it's simpler to just return early, as + // redundant disconnect events can fire, though they should be rare. + return; + } + if self.announcement_sigs_state == AnnouncementSigsState::MessageSent || self.announcement_sigs_state == AnnouncementSigsState::Committed { self.announcement_sigs_state = AnnouncementSigsState::NotSent; } @@ -4771,6 +4777,9 @@ impl Channel { } fn check_get_channel_ready(&mut self, height: u32) -> Option { + // Called: + // * always when a new block/transactions are confirmed with the new height + // * when funding is signed with a height of 0 if self.funding_tx_confirmation_height == 0 && self.minimum_depth != Some(0) { return None; } @@ -4796,7 +4805,7 @@ impl Channel { // We got a reorg but not enough to trigger a force close, just ignore. false } else { - if self.channel_state < ChannelState::ChannelFunded as u32 { + if self.funding_tx_confirmation_height != 0 && 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,