mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-24 08:49:29 +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 {
|
||||
cpy := make([]*types.Log, len(logs))
|
||||
for i, l := range logs {
|
||||
cpy[i] = new(types.Log)
|
||||
*cpy[i] = *l
|
||||
c := *l
|
||||
c.Topics = slices.Clone(l.Topics)
|
||||
c.Data = common.CopyBytes(l.Data)
|
||||
cpy[i] = &c
|
||||
}
|
||||
state.logs[hash] = cpy
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue