core/state: using slices.Clone (#29366)

pull/29386/head
cui 8 months ago committed by GitHub
parent 3754a6cc92
commit 7481398a24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      core/state/statedb.go

@ -20,6 +20,7 @@ package state
import (
"fmt"
"math/big"
"slices"
"sort"
"time"
@ -243,9 +244,7 @@ func (s *StateDB) Logs() []*types.Log {
func (s *StateDB) AddPreimage(hash common.Hash, preimage []byte) {
if _, ok := s.preimages[hash]; !ok {
s.journal.append(addPreimageChange{hash: hash})
pi := make([]byte, len(preimage))
copy(pi, preimage)
s.preimages[hash] = pi
s.preimages[hash] = slices.Clone(preimage)
}
}

Loading…
Cancel
Save