mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
core/state: check dirty storage in post-check
This commit is contained in:
parent
3380364a4a
commit
29ef67ccfc
1 changed files with 15 additions and 1 deletions
|
|
@ -558,10 +558,14 @@ func forEachStorage(s *StateDB, addr common.Address, cb func(key, value common.H
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
it := trie.NewIterator(trieIt)
|
||||
var (
|
||||
it = trie.NewIterator(trieIt)
|
||||
visited = make(map[common.Hash]bool)
|
||||
)
|
||||
|
||||
for it.Next() {
|
||||
key := common.BytesToHash(s.trie.GetKey(it.Key))
|
||||
visited[key] = true
|
||||
if value, dirty := so.dirtyStorage[key]; dirty {
|
||||
if !cb(key, value) {
|
||||
return nil
|
||||
|
|
@ -579,6 +583,16 @@ func forEachStorage(s *StateDB, addr common.Address, cb func(key, value common.H
|
|||
}
|
||||
}
|
||||
}
|
||||
// Now visit any remaining dirty storage which is not in trie
|
||||
for key, value := range so.dirtyStorage {
|
||||
if visited[key] {
|
||||
continue
|
||||
}
|
||||
if !cb(key, value) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue