good morning!!!!

Skip to content
Snippets Groups Projects
Commit c3f7e3be authored by Gary Rong's avatar Gary Rong Committed by Péter Szilágyi
Browse files

core/statedb: deep copy logs (#17489)

parent 67d6d0bb
No related branches found
No related tags found
No related merge requests found
...@@ -489,10 +489,13 @@ func (self *StateDB) Copy() *StateDB { ...@@ -489,10 +489,13 @@ func (self *StateDB) Copy() *StateDB {
state.stateObjectsDirty[addr] = struct{}{} state.stateObjectsDirty[addr] = struct{}{}
} }
} }
for hash, logs := range self.logs { for hash, logs := range self.logs {
state.logs[hash] = make([]*types.Log, len(logs)) cpy := make([]*types.Log, len(logs))
copy(state.logs[hash], logs) for i, l := range logs {
cpy[i] = new(types.Log)
*cpy[i] = *l
}
state.logs[hash] = cpy
} }
for hash, preimage := range self.preimages { for hash, preimage := range self.preimages {
state.preimages[hash] = preimage state.preimages[hash] = preimage
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment