Skip to content

Commit 3fb9fbf

Browse files
aaronbuchwaldtcrypt25519
authored andcommitted
core/state: small trie prefetcher nits (ethereum#28183)
Small trie prefetcher nits
1 parent 8d239ed commit 3fb9fbf

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

core/state/trie_prefetcher.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var (
3737
type triePrefetcher struct {
3838
db Database // Database to fetch trie nodes through
3939
root common.Hash // Root hash of the account trie for metrics
40-
fetches map[string]Trie // Partially or fully fetcher tries
40+
fetches map[string]Trie // Partially or fully fetched tries. Only populated for inactive copies.
4141
fetchers map[string]*subfetcher // Subfetchers for each trie
4242

4343
deliveryMissMeter metrics.Meter
@@ -197,7 +197,10 @@ func (p *triePrefetcher) used(owner common.Hash, root common.Hash, used [][]byte
197197

198198
// trieID returns an unique trie identifier consists the trie owner and root hash.
199199
func (p *triePrefetcher) trieID(owner common.Hash, root common.Hash) string {
200-
return string(append(owner.Bytes(), root.Bytes()...))
200+
trieID := make([]byte, common.HashLength*2)
201+
copy(trieID, owner.Bytes())
202+
copy(trieID[common.HashLength:], root.Bytes())
203+
return string(trieID)
201204
}
202205

203206
// subfetcher is a trie fetcher goroutine responsible for pulling entries for a

0 commit comments

Comments
 (0)