From e0813b6b5217212505aeae1309ee7ad3e9d2ea7e Mon Sep 17 00:00:00 2001 From: devopsbo3 <69951731+devopsbo3@users.noreply.github.com> Date: Fri, 10 Nov 2023 12:27:53 -0600 Subject: [PATCH] Revert "internal/ethapi: make EstimateGas use `latest` block by default (#24363)" This reverts commit 4f615dec62f75cd49db6767fb9cd3e03c444506c. --- graphql/graphql.go | 4 ++-- internal/ethapi/api.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/graphql/graphql.go b/graphql/graphql.go index 1ac439753d..ac80304f87 100644 --- a/graphql/graphql.go +++ b/graphql/graphql.go @@ -1150,8 +1150,8 @@ func (p *Pending) Call(ctx context.Context, args struct { func (p *Pending) EstimateGas(ctx context.Context, args struct { Data ethapi.TransactionArgs }) (hexutil.Uint64, error) { - latestBlockNr := rpc.BlockNumberOrHashWithNumber(rpc.LatestBlockNumber) - return ethapi.DoEstimateGas(ctx, p.r.backend, args.Data, latestBlockNr, p.r.backend.RPCGasCap()) + pendingBlockNr := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber) + return ethapi.DoEstimateGas(ctx, p.r.backend, args.Data, pendingBlockNr, p.r.backend.RPCGasCap()) } // Resolver is the top-level object in the GraphQL hierarchy. diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 589a0eed33..9a0aed7b18 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1217,7 +1217,7 @@ func DoEstimateGas(ctx context.Context, b Backend, args TransactionArgs, blockNr // EstimateGas returns an estimate of the amount of gas needed to execute the // given transaction against the current pending block. func (s *BlockChainAPI) EstimateGas(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error) { - bNrOrHash := rpc.BlockNumberOrHashWithNumber(rpc.LatestBlockNumber) + bNrOrHash := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber) if blockNrOrHash != nil { bNrOrHash = *blockNrOrHash }