trie: fix bloom crash on fast sync restart #22332 (#1060)

This commit is contained in:
Daniel Liu 2025-06-03 11:54:40 +08:00 committed by GitHub
parent b18f9f2705
commit 958ad72b8e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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()