From e991bdae2458dbee5a28addd188a897858aa34dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= <peterke@gmail.com>
Date: Tue, 16 Feb 2021 10:44:38 +0200
Subject: [PATCH] trie: fix bloom crash on fast sync restart
---
trie/sync.go | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/trie/sync.go b/trie/sync.go
index 05b9f55d3..dd8279b66 100644
--- a/trie/sync.go
+++ b/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()
--
GitLab