Merge pull request #3009 from Gustav-Simonsson/fix_oom_in_light

light: fix memory expansion bug (same as fix for core/state)
This commit is contained in:
Felix Lange 2016-09-22 13:11:59 +02:00 committed by GitHub
commit 3778f1bf77
2 changed files with 4 additions and 2 deletions

View File

@ -261,8 +261,10 @@ func (self *LightState) Copy() *LightState {
state := NewLightState(common.Hash{}, self.odr) state := NewLightState(common.Hash{}, self.odr)
state.trie = self.trie state.trie = self.trie
for k, stateObject := range self.stateObjects { for k, stateObject := range self.stateObjects {
if stateObject.dirty {
state.stateObjects[k] = stateObject.Copy() state.stateObjects[k] = stateObject.Copy()
} }
}
return state return state
} }

View File

@ -186,7 +186,7 @@ func (self *StateObject) Copy() *StateObject {
stateObject.codeHash = common.CopyBytes(self.codeHash) stateObject.codeHash = common.CopyBytes(self.codeHash)
stateObject.nonce = self.nonce stateObject.nonce = self.nonce
stateObject.trie = self.trie stateObject.trie = self.trie
stateObject.code = common.CopyBytes(self.code) stateObject.code = self.code
stateObject.storage = self.storage.Copy() stateObject.storage = self.storage.Copy()
stateObject.remove = self.remove stateObject.remove = self.remove
stateObject.dirty = self.dirty stateObject.dirty = self.dirty