From 22eea17b0672fc8be84b655f995f3f2555446c5e Mon Sep 17 00:00:00 2001 From: Gustav Simonsson Date: Mon, 19 Sep 2016 02:13:14 -0400 Subject: [PATCH] light: fix memory expansion bug (same as fix for core/state) --- light/state.go | 4 +++- light/state_object.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/light/state.go b/light/state.go index e18f9cdc5..4f2177238 100644 --- a/light/state.go +++ b/light/state.go @@ -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 diff --git a/light/state_object.go b/light/state_object.go index 08c209d7d..1e9c7f4b1 100644 --- a/light/state_object.go +++ b/light/state_object.go @@ -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