Explorar o código

trie: fix bloom crash on fast sync restart

Péter Szilágyi %!s(int64=4) %!d(string=hai) anos
pai
achega
e991bdae24
Modificáronse 1 ficheiros con 6 adicións e 2 borrados
  1. 6 2
      trie/sync.go

+ 6 - 2
trie/sync.go

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