Skip to content

Commit

Permalink
light: fix memory expansion bug (same as fix for core/state)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustav Simonsson committed Sep 19, 2016
1 parent c8d6efd commit 22eea17
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion light/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ func (self *LightState) Copy() *LightState {
state := NewLightState(common.Hash{}, self.odr)
state.trie = self.trie
for k, stateObject := range self.stateObjects {
state.stateObjects[k] = stateObject.Copy()
if stateObject.dirty {
state.stateObjects[k] = stateObject.Copy()
}
}

return state
Expand Down
2 changes: 1 addition & 1 deletion light/state_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (self *StateObject) Copy() *StateObject {
stateObject.codeHash = common.CopyBytes(self.codeHash)
stateObject.nonce = self.nonce
stateObject.trie = self.trie
stateObject.code = common.CopyBytes(self.code)
stateObject.code = self.code
stateObject.storage = self.storage.Copy()
stateObject.remove = self.remove
stateObject.dirty = self.dirty
Expand Down

0 comments on commit 22eea17

Please sign in to comment.