mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-31 03:58:36 +00:00
core/state: deep copy slices
This commit is contained in:
parent
934a0091fa
commit
ecdd8c47cf
1 changed files with 4 additions and 2 deletions
|
|
@ -735,8 +735,10 @@ func (s *StateDB) Copy() *StateDB {
|
||||||
for hash, logs := range s.logs {
|
for hash, logs := range s.logs {
|
||||||
cpy := make([]*types.Log, len(logs))
|
cpy := make([]*types.Log, len(logs))
|
||||||
for i, l := range logs {
|
for i, l := range logs {
|
||||||
cpy[i] = new(types.Log)
|
c := *l
|
||||||
*cpy[i] = *l
|
c.Topics = slices.Clone(l.Topics)
|
||||||
|
c.Data = common.CopyBytes(l.Data)
|
||||||
|
cpy[i] = &c
|
||||||
}
|
}
|
||||||
state.logs[hash] = cpy
|
state.logs[hash] = cpy
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue