trie: fix bloom crash on fast sync restart

This commit is contained in:
Péter Szilágyi 2021-02-16 10:44:38 +02:00
parent 7d1b711c7d
commit e991bdae24
No known key found for this signature in database
GPG Key ID: E9AE538CEDF8293D
1 changed files with 6 additions and 2 deletions

View File

@ -313,11 +313,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()