Clone secKeyCache to a new stateTrie instance

This commit is contained in:
maskpp 2025-06-03 22:18:43 +08:00
parent 1d7fbc0fbc
commit 4c0029282b

View file

@ -17,6 +17,8 @@
package trie
import (
"maps"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
@ -273,7 +275,7 @@ func (t *StateTrie) Copy() *StateTrie {
return &StateTrie{
trie: *t.trie.Copy(),
db: t.db,
secKeyCache: make(map[common.Hash][]byte),
secKeyCache: maps.Clone(t.secKeyCache),
preimages: t.preimages,
}
}