Merge pull request #22332 from karalabe/fix-fastsync-restart-bloom-crash

trie: fix bloom crash on fast sync restart
This commit is contained in:
Péter Szilágyi 2021-02-16 13:30:15 +02:00 committed by GitHub
commit 915c614959
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -313,12 +313,16 @@ 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)
if s.bloom != nil {
s.bloom.Add(key[:])
}
}
for key, value := range s.membatch.codes {
rawdb.WriteCode(dbw, key, value)
if s.bloom != nil {
s.bloom.Add(key[:])
}
}
// Drop the membatch data and return
s.membatch = newSyncMemBatch()
return nil