Skip to content

Commit 6970333

Browse files
committed
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.
1 parent 4074909 commit 6970333

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,12 +1927,12 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
19271927
if height > self.best_block.height() {
19281928
self.best_block = BestBlock::new(block_hash, height);
19291929
self.block_confirmed(height, vec![], vec![], vec![], broadcaster, fee_estimator, logger)
1930-
} else {
1930+
} else if block_hash != self.best_block.block_hash() {
19311931
self.best_block = BestBlock::new(block_hash, height);
19321932
self.onchain_events_awaiting_threshold_conf.retain(|ref entry| entry.height <= height);
19331933
self.onchain_tx_handler.block_disconnected(height + 1, broadcaster, fee_estimator, logger);
19341934
Vec::new()
1935-
}
1935+
} else { Vec::new() }
19361936
}
19371937

19381938
fn transactions_confirmed<B: Deref, F: Deref, L: Deref>(

0 commit comments

Comments
 (0)