mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 05:11:37 +00:00
core/state: increment storage counters in binary trie IntermediateRoot path
The binary trie fast path in IntermediateRoot() directly iterates uncommittedStorage and calls UpdateStorage/DeleteStorage, bypassing the per-account updateTrie() method. However, it omitted the StorageUpdated and StorageDeleted counter increments that updateTrie() performs, causing the "Slow block" JSON log to always report storage_slots_written=0 in binary trie mode. Add the missing counter increments to match the behavior in state_object.go's updateTrie().
This commit is contained in:
parent
acdd139717
commit
cdc3100cb3
1 changed files with 2 additions and 0 deletions
|
|
@ -881,10 +881,12 @@ func (s *StateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash {
|
||||||
if err := s.trie.UpdateStorage(addr, key[:], common.TrimLeftZeroes(value[:])); err != nil {
|
if err := s.trie.UpdateStorage(addr, key[:], common.TrimLeftZeroes(value[:])); err != nil {
|
||||||
s.setError(err)
|
s.setError(err)
|
||||||
}
|
}
|
||||||
|
s.StorageUpdated.Add(1)
|
||||||
} else {
|
} else {
|
||||||
if err := s.trie.DeleteStorage(addr, key[:]); err != nil {
|
if err := s.trie.DeleteStorage(addr, key[:]); err != nil {
|
||||||
s.setError(err)
|
s.setError(err)
|
||||||
}
|
}
|
||||||
|
s.StorageDeleted.Add(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue