mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
ethdb: check key length to prevent hash computation
This commit is contained in:
parent
86e3f1fc3a
commit
f523b2a501
2 changed files with 2 additions and 2 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue