Fix eth_feeHistory (#4168)

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
This commit is contained in:
ledgerwatch 2022-05-16 21:42:23 +01:00 committed by GitHub
parent d845eb2a69
commit a2a494a3d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)