Skip to content

Commit

Permalink
core/state: small trie prefetcher nits (#28183)
Browse files Browse the repository at this point in the history
Small trie prefetcher nits
  • Loading branch information
aaronbuchwald authored Sep 29, 2023
1 parent 0ded110 commit c5ff839
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/state/trie_prefetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var (
type triePrefetcher struct {
db Database // Database to fetch trie nodes through
root common.Hash // Root hash of the account trie for metrics
fetches map[string]Trie // Partially or fully fetcher tries
fetches map[string]Trie // Partially or fully fetched tries. Only populated for inactive copies.
fetchers map[string]*subfetcher // Subfetchers for each trie

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

// trieID returns an unique trie identifier consists the trie owner and root hash.
func (p *triePrefetcher) trieID(owner common.Hash, root common.Hash) string {
return string(append(owner.Bytes(), root.Bytes()...))
trieID := make([]byte, common.HashLength*2)
copy(trieID, owner.Bytes())
copy(trieID[common.HashLength:], root.Bytes())
return string(trieID)
}

// subfetcher is a trie fetcher goroutine responsible for pulling entries for a
Expand Down

0 comments on commit c5ff839

Please sign in to comment.