X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fchain%2Fchannelmonitor.rs;h=a0f5eb71d7b3fdf69ef076183fdb1ccc76ff0fc4;hb=1d4f9c8dec54a276834fb563d4b82e852ba931f6;hp=fe581ac65adcfeb0e4936ad32024bd01a19b6396;hpb=0e101417a55a01dbc4ecff8ab9596d816c1cb2e9;p=rust-lightning diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs index fe581ac6..a0f5eb71 100644 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@ -362,7 +362,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 {