forked from cerc-io/plugeth
trie: fix bloom crash on fast sync restart
This commit is contained in:
parent
7d1b711c7d
commit
e991bdae24
@ -313,11 +313,15 @@ func (s *Sync) Commit(dbw ethdb.Batch) error {
|
|||||||
// Dump the membatch into a database dbw
|
// Dump the membatch into a database dbw
|
||||||
for key, value := range s.membatch.nodes {
|
for key, value := range s.membatch.nodes {
|
||||||
rawdb.WriteTrieNode(dbw, key, value)
|
rawdb.WriteTrieNode(dbw, key, value)
|
||||||
s.bloom.Add(key[:])
|
if s.bloom != nil {
|
||||||
|
s.bloom.Add(key[:])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for key, value := range s.membatch.codes {
|
for key, value := range s.membatch.codes {
|
||||||
rawdb.WriteCode(dbw, key, value)
|
rawdb.WriteCode(dbw, key, value)
|
||||||
s.bloom.Add(key[:])
|
if s.bloom != nil {
|
||||||
|
s.bloom.Add(key[:])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Drop the membatch data and return
|
// Drop the membatch data and return
|
||||||
s.membatch = newSyncMemBatch()
|
s.membatch = newSyncMemBatch()
|
||||||
|
Loading…
Reference in New Issue
Block a user