|
|
@ -474,6 +474,16 @@ func (self *StateDB) Copy() *StateDB { |
|
|
|
state.stateObjects[addr] = self.stateObjects[addr].deepCopy(state) |
|
|
|
state.stateObjects[addr] = self.stateObjects[addr].deepCopy(state) |
|
|
|
state.stateObjectsDirty[addr] = struct{}{} |
|
|
|
state.stateObjectsDirty[addr] = struct{}{} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Above, we don't copy the actual journal. This means that if the copy is copied, the
|
|
|
|
|
|
|
|
// loop above will be a no-op, since the copy's journal is empty.
|
|
|
|
|
|
|
|
// Thus, here we iterate over stateObjects, to enable copies of copies
|
|
|
|
|
|
|
|
for addr := range self.stateObjectsDirty { |
|
|
|
|
|
|
|
if _, exist := state.stateObjects[addr]; !exist { |
|
|
|
|
|
|
|
state.stateObjects[addr] = self.stateObjects[addr].deepCopy(state) |
|
|
|
|
|
|
|
state.stateObjectsDirty[addr] = struct{}{} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for hash, logs := range self.logs { |
|
|
|
for hash, logs := range self.logs { |
|
|
|
state.logs[hash] = make([]*types.Log, len(logs)) |
|
|
|
state.logs[hash] = make([]*types.Log, len(logs)) |
|
|
|
copy(state.logs[hash], logs) |
|
|
|
copy(state.logs[hash], logs) |
|
|
|