[release 1.4.12] core/state: Fix memory expansion bug by not copying clean objects
(cherry picked from commit 581b320b9d
)
This commit is contained in:
committed by
Péter Szilágyi
parent
99a0c76435
commit
e44b2dc881
@@ -324,7 +324,9 @@ func (self *StateDB) Copy() *StateDB {
|
||||
state, _ := New(common.Hash{}, self.db)
|
||||
state.trie = self.trie
|
||||
for k, stateObject := range self.stateObjects {
|
||||
state.stateObjects[k] = stateObject.Copy()
|
||||
if stateObject.dirty {
|
||||
state.stateObjects[k] = stateObject.Copy()
|
||||
}
|
||||
}
|
||||
|
||||
state.refund.Set(self.refund)
|
||||
@@ -364,7 +366,6 @@ func (s *StateDB) IntermediateRoot() common.Hash {
|
||||
stateObject.Update()
|
||||
s.UpdateStateObject(stateObject)
|
||||
}
|
||||
stateObject.dirty = false
|
||||
}
|
||||
}
|
||||
return s.trie.Hash()
|
||||
|
Reference in New Issue
Block a user