From 958ad72b8ef2b3a2d4dbf5630eaf4bb3ba31edda Mon Sep 17 00:00:00 2001 From: Daniel Liu <139250065@qq.com> Date: Tue, 3 Jun 2025 11:54:40 +0800 Subject: [PATCH] trie: fix bloom crash on fast sync restart #22332 (#1060) --- trie/sync.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/trie/sync.go b/trie/sync.go index a1ac09dfa9..f6a52131cc 100644 --- a/trie/sync.go +++ b/trie/sync.go @@ -268,11 +268,15 @@ func (s *Sync) Commit(dbw ethdb.Batch) error { // Dump the membatch into a database dbw for key, value := range s.membatch.nodes { rawdb.WriteTrieNode(dbw, key, value) - s.bloom.Add(key[:]) + if s.bloom != nil { + s.bloom.Add(key[:]) + } } for key, value := range s.membatch.codes { rawdb.WriteCode(dbw, key, value) - s.bloom.Add(key[:]) + if s.bloom != nil { + s.bloom.Add(key[:]) + } } // Drop the membatch data and return s.membatch = newSyncMemBatch()