Skip to content

Commit 6dd9167

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 871d4a3 commit 6dd9167

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
@@ -1931,12 +1931,12 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
19311931
if height > self.best_block.height() {
19321932
self.best_block = BestBlock::new(block_hash, height);
19331933
self.block_confirmed(height, vec![], vec![], vec![], broadcaster, fee_estimator, logger)
1934-
} else {
1934+
} else if self.best_block.block_hash() != block_hash {
19351935
self.best_block = BestBlock::new(block_hash, height);
19361936
self.onchain_events_awaiting_threshold_conf.retain(|ref entry| entry.height <= height);
19371937
self.onchain_tx_handler.block_disconnected(height + 1, broadcaster, fee_estimator, logger);
19381938
Vec::new()
1939-
}
1939+
} else { Vec::new() }
19401940
}
19411941

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

0 commit comments

Comments
 (0)