core, eth, trie, light: clean up trie interface (#26388)

* all: cleanup trie interface

* eth, trie: address comments
This commit is contained in:
rjl493456442
2023-01-03 15:41:40 +02:00
committed by GitHub
parent 41fe9d646c
commit 6c149fd4ad
7 changed files with 38 additions and 35 deletions
+2 -2
View File
@@ -417,7 +417,7 @@ func ServiceGetStorageRangesQuery(chain *core.BlockChain, req *GetStorageRangesP
if err != nil {
return nil, nil
}
acc, err := accTrie.TryGetAccountWithPreHashedKey(account[:])
acc, err := accTrie.TryGetAccountByHash(account)
if err != nil || acc == nil {
return nil, nil
}
@@ -523,7 +523,7 @@ func ServiceGetTrieNodesQuery(chain *core.BlockChain, req *GetTrieNodesPacket, s
if snap == nil {
// We don't have the requested state snapshotted yet (or it is stale),
// but can look up the account via the trie instead.
account, err := accTrie.TryGetAccountWithPreHashedKey(pathset[0])
account, err := accTrie.TryGetAccountByHash(common.BytesToHash(pathset[0]))
loads += 8 // We don't know the exact cost of lookup, this is an estimate
if err != nil || account == nil {
break
+1 -1
View File
@@ -3083,7 +3083,7 @@ func (t *healRequestSort) Swap(i, j int) {
func (t *healRequestSort) Merge() []TrieNodePathSet {
var result []TrieNodePathSet
for _, path := range t.syncPaths {
pathset := TrieNodePathSet([][]byte(path))
pathset := TrieNodePathSet(path)
if len(path) == 1 {
// It's an account reference.
result = append(result, pathset)