mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
core/state: add check after Slot
This commit is contained in:
parent
44fd10aa98
commit
ee5b52de5a
1 changed files with 6 additions and 3 deletions
|
|
@ -1049,13 +1049,13 @@ func (s *StateDB) fastDeleteStorage(addrHash common.Hash, root common.Hash) (boo
|
|||
size += common.StorageSize(len(path))
|
||||
})
|
||||
for iter.Next() {
|
||||
if iter.Error() != nil {
|
||||
return false, 0, nil, nil, err
|
||||
}
|
||||
if size > storageDeleteLimit {
|
||||
return true, size, nil, nil, nil
|
||||
}
|
||||
slot := common.CopyBytes(iter.Slot())
|
||||
if iter.Error() != nil { // error might occur after Slot function
|
||||
return false, 0, nil, nil, err
|
||||
}
|
||||
size += common.StorageSize(common.HashLength + len(slot))
|
||||
slots[iter.Hash()] = slot
|
||||
|
||||
|
|
@ -1063,6 +1063,9 @@ func (s *StateDB) fastDeleteStorage(addrHash common.Hash, root common.Hash) (boo
|
|||
return false, 0, nil, nil, err
|
||||
}
|
||||
}
|
||||
if iter.Error() != nil { // error might occur during iteration
|
||||
return false, 0, nil, nil, err
|
||||
}
|
||||
if stack.Hash() != root {
|
||||
return false, 0, nil, nil, fmt.Errorf("snapshot is not matched, exp %x, got %x", root, stack.Hash())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue