From 7481398a2471f52de277627cc473190f0c2569c8 Mon Sep 17 00:00:00 2001 From: cui <523516579@qq.com> Date: Thu, 28 Mar 2024 19:13:41 +0800 Subject: [PATCH] core/state: using slices.Clone (#29366) --- core/state/statedb.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/state/statedb.go b/core/state/statedb.go index 981eea7d6f..8cdcbc40c3 100644 --- a/core/state/statedb.go +++ b/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) } }