From 697033342e3f5cb8bb524843c409ede8a39368c1 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Fri, 25 Jun 2021 04:14:50 +0000 Subject: [PATCH] Avoid calling OnchainTx::block_disconnected if no block was discon'd There are no visible effects of this, but it seems like good code hygiene to not call a disconnect function in a different file if no disconnect happened. --- lightning/src/chain/channelmonitor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs index 009281958..d1e6e8114 100644 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@ -1927,12 +1927,12 @@ impl ChannelMonitorImpl { if height > self.best_block.height() { self.best_block = BestBlock::new(block_hash, height); self.block_confirmed(height, vec![], vec![], vec![], broadcaster, fee_estimator, logger) - } else { + } else if block_hash != self.best_block.block_hash() { self.best_block = BestBlock::new(block_hash, height); self.onchain_events_awaiting_threshold_conf.retain(|ref entry| entry.height <= height); self.onchain_tx_handler.block_disconnected(height + 1, broadcaster, fee_estimator, logger); Vec::new() - } + } else { Vec::new() } } fn transactions_confirmed( -- 2.39.5