Skip to content

Commit adaf9da

Browse files
committed
fix
1 parent 991b4dd commit adaf9da

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

crates/chain-state/src/in_memory.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,12 @@ impl<N: NodePrimitives> CanonicalInMemoryState<N> {
375375
/// the invalid fork from in-memory state, preventing it from being referenced
376376
/// during state provider construction.
377377
pub fn remove_invalid_block_and_descendants(&self, invalid_block_hash: B256) {
378-
// First, collect all blocks that need to be removed using BFS
378+
// If the block doesn't exist in the state, there's nothing to remove
379+
if !self.inner.in_memory_state.blocks.read().contains_key(&invalid_block_hash) {
380+
return;
381+
}
382+
383+
// Collect all blocks that need to be removed using BFS
379384
let mut blocks_to_remove = std::collections::HashSet::new();
380385
let mut queue = VecDeque::from([invalid_block_hash]);
381386

0 commit comments

Comments
 (0)