aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgary rong <garyrong0905@gmail.com>2018-08-23 20:59:58 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-08-23 20:59:58 +0800
commitc3f7e3be3b60df3edd168e80aa89ee2992932b0d (patch)
treeaa74e9e134109df7389355aeaa1d3b2a60b610d5
parent67d6d0bb7d0e9b18334d45e2d811f00746320d65 (diff)
downloadgo-tangerine-c3f7e3be3b60df3edd168e80aa89ee2992932b0d.tar
go-tangerine-c3f7e3be3b60df3edd168e80aa89ee2992932b0d.tar.gz
go-tangerine-c3f7e3be3b60df3edd168e80aa89ee2992932b0d.tar.bz2
go-tangerine-c3f7e3be3b60df3edd168e80aa89ee2992932b0d.tar.lz
go-tangerine-c3f7e3be3b60df3edd168e80aa89ee2992932b0d.tar.xz
go-tangerine-c3f7e3be3b60df3edd168e80aa89ee2992932b0d.tar.zst
go-tangerine-c3f7e3be3b60df3edd168e80aa89ee2992932b0d.zip
core/statedb: deep copy logs (#17489)
-rw-r--r--core/state/statedb.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/state/statedb.go b/core/state/statedb.go
index 92d394ae3..101b03a12 100644
--- a/core/state/statedb.go
+++ b/core/state/statedb.go
@@ -489,10 +489,13 @@ func (self *StateDB) Copy() *StateDB {
state.stateObjectsDirty[addr] = struct{}{}
}
}
-
for hash, logs := range self.logs {
- state.logs[hash] = make([]*types.Log, len(logs))
- copy(state.logs[hash], logs)
+ cpy := make([]*types.Log, len(logs))
+ for i, l := range logs {
+ cpy[i] = new(types.Log)
+ *cpy[i] = *l
+ }
+ state.logs[hash] = cpy
}
for hash, preimage := range self.preimages {
state.preimages[hash] = preimage