From a2a494a3d110904f0fec087f984da4bdf1cf7c9e Mon Sep 17 00:00:00 2001 From: ledgerwatch Date: Mon, 16 May 2022 21:42:23 +0100 Subject: [PATCH] Fix eth_feeHistory (#4168) Co-authored-by: Alexey Sharp --- cmd/rpcdaemon/commands/eth_system.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/cmd/rpcdaemon/commands/eth_system.go b/cmd/rpcdaemon/commands/eth_system.go index 9cff08d16..e9969f5d0 100644 --- a/cmd/rpcdaemon/commands/eth_system.go +++ b/cmd/rpcdaemon/commands/eth_system.go @@ -2,7 +2,6 @@ package commands import ( "context" - "fmt" "github.com/ledgerwatch/erigon-lib/kv" "github.com/ledgerwatch/erigon/common" @@ -199,16 +198,11 @@ func NewGasPriceOracleBackend(tx kv.Tx, cc *params.ChainConfig, baseApi *BaseAPI } func (b *GasPriceOracleBackend) HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error) { - blockNum, err := getBlockNumber(number, b.tx) + block, err := b.baseApi.blockByRPCNumber(number, b.tx) if err != nil { return nil, err } - - header := rawdb.ReadHeaderByNumber(b.tx, blockNum) - if header == nil { - return nil, fmt.Errorf("header not found: %d", blockNum) - } - return header, nil + return block.Header(), nil } func (b *GasPriceOracleBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error) { return b.baseApi.blockByRPCNumber(number, b.tx)