diff --git a/ethdb/leveldb/leveldb.go b/ethdb/leveldb/leveldb.go index e04e7c5bea..6e3e1efdbb 100644 --- a/ethdb/leveldb/leveldb.go +++ b/ethdb/leveldb/leveldb.go @@ -232,7 +232,7 @@ func (db *Database) DeleteRange(start, end []byte) error { }() for it.Next() && bytes.Compare(end, it.Key()) > 0 { // Prevent deletion for trie nodes in hash mode - if h := crypto.HashData(buff, it.Value()); h == common.BytesToHash(it.Key()) { + if len(it.Key()) == 32 && crypto.HashData(buff, it.Value()) == common.BytesToHash(it.Key()) { ignored++ continue } diff --git a/ethdb/pebble/pebble.go b/ethdb/pebble/pebble.go index 423d0b3a52..d2cf7c18a5 100644 --- a/ethdb/pebble/pebble.go +++ b/ethdb/pebble/pebble.go @@ -370,7 +370,7 @@ func (d *Database) DeleteRange(start, end []byte) error { }() for it.Next() && bytes.Compare(end, it.Key()) > 0 { // Prevent deletion for trie nodes in hash mode - if h := crypto.HashData(buff, it.Value()); h == common.BytesToHash(it.Key()) { + if len(it.Key()) == 32 && crypto.HashData(buff, it.Value()) == common.BytesToHash(it.Key()) { ignored++ continue }