-
Notifications
You must be signed in to change notification settings - Fork 20.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core, eth, trie, light: clean up trie interface #26388
Conversation
Let's hold-on this PR for a while. I am not sure the change for |
b5809b5
to
45743bc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, only minor suggestion to name them ByHash
instead of WithHash
, since it refers to whether we look it up by hash.
eth/protocols/snap/handler.go
Outdated
@@ -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.TryGetAccountWithHash(common.BytesToHash(pathset[0])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
account, err := accTrie.TryGetAccountWithHash(common.BytesToHash(pathset[0])) | |
account, err := accTrie.TryGetAccountByHash(common.BytesToHash(pathset[0])) |
?
eth/protocols/snap/handler.go
Outdated
@@ -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.TryGetAccountWithHash(account) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
acc, err := accTrie.TryGetAccountWithHash(account) | |
acc, err := accTrie.TryGetAccountByHash(account) |
?
* all: cleanup trie interface * eth, trie: address comments
This PR cleans up/improves some trie interfaces:
TryGetAccount
,TryUpdateAccount
,TryDeleteAccount
acceptscommon.Address
as the parameters, which is more intuitive to callers