Enrich TooManySiblingBlocks error info (#13052)

This commit is contained in:
Liu-Cheng Xu
2023-01-04 06:00:10 +08:00
committed by GitHub
parent 169cbc69c5
commit 1db2dc5b36
2 changed files with 9 additions and 3 deletions
@@ -283,7 +283,12 @@ impl<BlockHash: Hash, Key: Hash> NonCanonicalOverlay<BlockHash, Key> {
};
if level.blocks.len() >= MAX_BLOCKS_PER_LEVEL as usize {
return Err(StateDbError::TooManySiblingBlocks)
trace!(
target: "state-db",
"Too many sibling blocks at #{number}: {:?}",
level.blocks.iter().map(|b| &b.hash).collect::<Vec<_>>()
);
return Err(StateDbError::TooManySiblingBlocks { number })
}
if level.blocks.iter().any(|b| b.hash == *hash) {
return Err(StateDbError::BlockAlreadyExists)