core/state, eth, internal/ethapi: address comments

This commit is contained in:
Gary Rong 2023-08-30 19:39:33 +08:00
parent 6c825a92f3
commit 6dbca7e186
3 changed files with 4 additions and 4 deletions

View file

@ -295,9 +295,9 @@ func (s *StateDB) GetNonce(addr common.Address) uint64 {
return 0
}
// GetStateRoot retrieves the storage root from the given address or empty
// GetStorageRoot retrieves the storage root from the given address or empty
// if object not found.
func (s *StateDB) GetStateRoot(addr common.Address) common.Hash {
func (s *StateDB) GetStorageRoot(addr common.Address) common.Hash {
stateObject := s.getStateObject(addr)
if stateObject != nil {
return stateObject.Root()

View file

@ -230,7 +230,7 @@ func (api *DebugAPI) StorageRangeAt(ctx context.Context, blockNrOrHash rpc.Block
}
func storageRangeAt(statedb *state.StateDB, root common.Hash, address common.Address, start []byte, maxResult int) (StorageRangeResult, error) {
storageRoot := statedb.GetStateRoot(address)
storageRoot := statedb.GetStorageRoot(address)
if storageRoot == types.EmptyRootHash || storageRoot == (common.Hash{}) {
return StorageRangeResult{}, nil // empty storage
}

View file

@ -692,7 +692,7 @@ func (s *BlockChainAPI) GetProof(ctx context.Context, address common.Address, st
if state == nil || err != nil {
return nil, err
}
if storageRoot := state.GetStateRoot(address); storageRoot != types.EmptyRootHash && storageRoot != (common.Hash{}) {
if storageRoot := state.GetStorageRoot(address); storageRoot != types.EmptyRootHash && storageRoot != (common.Hash{}) {
id := trie.StorageTrieID(header.Root, crypto.Keccak256Hash(address.Bytes()), storageRoot)
tr, err := trie.NewStateTrie(id, state.Database().TrieDB())
if err != nil {