Skip to content

Commit c3f7e3b

Browse files
rjl493456442karalabe
authored andcommitted
core/statedb: deep copy logs (#17489)
1 parent 67d6d0b commit c3f7e3b

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎core/state/statedb.go‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,10 +489,13 @@ func (self *StateDB) Copy() *StateDB {
489489
state.stateObjectsDirty[addr] = struct{}{}
490490
}
491491
}
492-
493492
for hash, logs := range self.logs {
494-
state.logs[hash] = make([]*types.Log, len(logs))
495-
copy(state.logs[hash], logs)
493+
cpy := make([]*types.Log, len(logs))
494+
for i, l := range logs {
495+
cpy[i] = new(types.Log)
496+
*cpy[i] = *l
497+
}
498+
state.logs[hash] = cpy
496499
}
497500
for hash, preimage := range self.preimages {
498501
state.preimages[hash] = preimage

0 commit comments

Comments
 (0)