Update secure_trie.go

This commit is contained in:
marukai67 2026-01-26 21:41:46 +01:00 committed by GitHub
parent c2595381bf
commit 69c38ec9c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -134,9 +134,9 @@ func (t *StateTrie) GetAccountByHash(addrHash common.Hash) (*types.StateAccount,
// PrefetchAccount attempts to resolve specific accounts from the database
// to accelerate subsequent trie operations.
func (t *StateTrie) PrefetchAccount(addresses []common.Address) error {
var keys [][]byte
for _, addr := range addresses {
keys = append(keys, crypto.Keccak256(addr.Bytes()))
keys := make([][]byte, len(addresses))
for i, addr := range addresses {
keys[i] = crypto.Keccak256(addr.Bytes())
}
return t.trie.Prefetch(keys)
}
@ -157,9 +157,9 @@ func (t *StateTrie) GetStorage(_ common.Address, key []byte) ([]byte, error) {
// PrefetchStorage attempts to resolve specific storage slots from the database
// to accelerate subsequent trie operations.
func (t *StateTrie) PrefetchStorage(_ common.Address, keys [][]byte) error {
var keylist [][]byte
for _, key := range keys {
keylist = append(keylist, crypto.Keccak256(key))
keylist := make([][]byte, len(keys))
for i, key := range keys {
keylist[i] = crypto.Keccak256(key)
}
return t.trie.Prefetch(keylist)
}