From 0c367b5551819b8e0f9a72775193f74b81608f1c Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Fri, 26 May 2023 14:42:15 +0200 Subject: [PATCH] fix --- eth/api.go | 10 ++++------ eth/backend.go | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/eth/api.go b/eth/api.go index ad97dd47c884e..7d9ee1abacd37 100644 --- a/eth/api.go +++ b/eth/api.go @@ -411,12 +411,10 @@ type storageEntry struct { // StorageRangeAt returns the storage at the given block height and transaction index. func (api *DebugAPI) StorageRangeAt(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash, txIndex int, contractAddress common.Address, keyStart hexutil.Bytes, maxResult int) (StorageRangeResult, error) { var block *types.Block - if number, ok := blockNrOrHash.Number(); ok { - block = api.eth.blockchain.GetBlockByNumber(uint64(number)) - } else if hash, ok := blockNrOrHash.Hash(); ok { - block = api.eth.blockchain.GetBlockByHash(hash) - } else { - return StorageRangeResult{}, errors.New("either block number or block hash must be specified") + + block, err := api.eth.APIBackend.BlockByNumberOrHash(ctx, blockNrOrHash) + if err != nil { + return StorageRangeResult{}, err } if block == nil { diff --git a/eth/backend.go b/eth/backend.go index 4caab9bad6059..4ba8df951b1b7 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -323,7 +323,7 @@ func (s *Ethereum) Etherbase() (eb common.Address, err error) { if etherbase != (common.Address{}) { return etherbase, nil } - return common.Address{}, fmt.Errorf("etherbase must be explicitly specified") + return common.Address{}, errors.New("etherbase must be explicitly specified") } // isLocalBlock checks whether the specified block is mined