mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 22:26:42 +00:00
core/state: use dirty flag to avoid db writes
Until now the dirty flag was unset in intermediate root. That resulted in not knowing whether a state object should be writte to disk or not. Being removed in 1.4.12, we can rely on it to avoid a ton of writes.
This commit is contained in:
parent
c9f5e4db76
commit
3b26d83d72
1 changed files with 1 additions and 1 deletions
|
|
@ -445,7 +445,7 @@ func (s *StateDB) commit(dbw trie.DatabaseWriter) (root common.Hash, err error)
|
||||||
// and just mark it for deletion in the trie.
|
// and just mark it for deletion in the trie.
|
||||||
s.DeleteStateObject(stateObject)
|
s.DeleteStateObject(stateObject)
|
||||||
delete(s.all, addr)
|
delete(s.all, addr)
|
||||||
} else {
|
} else if stateObject.dirty {
|
||||||
// Write any contract code associated with the state object
|
// Write any contract code associated with the state object
|
||||||
if stateObject.code != nil {
|
if stateObject.code != nil {
|
||||||
if err := dbw.Put(stateObject.CodeHash(), stateObject.code); err != nil {
|
if err := dbw.Put(stateObject.CodeHash(), stateObject.code); err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue