File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -375,7 +375,12 @@ impl<N: NodePrimitives> CanonicalInMemoryState<N> {
375
375
/// the invalid fork from in-memory state, preventing it from being referenced
376
376
/// during state provider construction.
377
377
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
379
384
let mut blocks_to_remove = std:: collections:: HashSet :: new ( ) ;
380
385
let mut queue = VecDeque :: from ( [ invalid_block_hash] ) ;
381
386
You can’t perform that action at this time.
0 commit comments