X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fchain%2Fchannelmonitor.rs;h=8ae4c13309f5585e23829faa13f503f24c1318bc;hb=e60ccbb1a8781bf5411919ea03b4f0cddb1ad77b;hp=26187ce34166d5a189a48a3be2522a46a181ceba;hpb=58a4f6c4ad3c262f7ed7009f6c99d36936e958b4;p=rust-lightning diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs index 26187ce3..8ae4c133 100644 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@ -335,7 +335,15 @@ struct OnchainEventEntry { impl OnchainEventEntry { fn confirmation_threshold(&self) -> u32 { - self.height + ANTI_REORG_DELAY - 1 + let mut conf_threshold = self.height + ANTI_REORG_DELAY - 1; + if let OnchainEvent::MaturingOutput { + descriptor: SpendableOutputDescriptor::DelayedPaymentOutput(ref descriptor) + } = self.event { + // A CSV'd transaction is confirmable in block (input height) + CSV delay, which means + // it's broadcastable when we see the previous block. + conf_threshold = cmp::max(conf_threshold, self.height + descriptor.to_self_delay as u32 - 1); + } + conf_threshold } fn has_reached_confirmation_threshold(&self, height: u32) -> bool {