Skip to content

Commit

Permalink
core/statedb: deep copy logs (ethereum#17489)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjl493456442 authored and karalabe committed Aug 23, 2018
1 parent 67d6d0b commit c3f7e3b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c3f7e3b

Please sign in to comment.