Skip to content

Commit

Permalink
trie: fix bloom crash on fast sync restart
Browse files Browse the repository at this point in the history
  • Loading branch information
karalabe committed Feb 16, 2021
1 parent 7d1b711 commit e991bda
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions trie/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit e991bda

Please sign in to comment.