chore(tree): log error on unreachable (#4185)

This commit is contained in:
Alexey Shekhirin
2023-08-14 12:23:17 +01:00
committed by GitHub
parent 957f9f4545
commit 2aefbd3560

View File

@ -972,6 +972,12 @@ impl<DB: Database, C: Consensus, EF: ExecutorFactory> BlockchainTree<DB, C, EF>
let canon_fork: BlockNumHash = new_canon_chain.fork_block();
// sanity check
if self.block_indices.canonical_hash(&canon_fork.number) != Some(canon_fork.hash) {
error!(
target: "blockchain_tree",
?canon_fork,
?self.block_indices,
"All chains should point to canonical chain"
);
unreachable!("all chains should point to canonical chain.");
}