Skip to content

Commit 9626714

Browse files
authored
Revert "internal/ethapi: make EstimateGas use latest block by default (ethereum#24363)"
This reverts commit 4f615de.
1 parent 0d681f1 commit 9626714

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

graphql/graphql.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,8 +1150,8 @@ func (p *Pending) Call(ctx context.Context, args struct {
11501150
func (p *Pending) EstimateGas(ctx context.Context, args struct {
11511151
Data ethapi.TransactionArgs
11521152
}) (hexutil.Uint64, error) {
1153-
latestBlockNr := rpc.BlockNumberOrHashWithNumber(rpc.LatestBlockNumber)
1154-
return ethapi.DoEstimateGas(ctx, p.r.backend, args.Data, latestBlockNr, p.r.backend.RPCGasCap())
1153+
pendingBlockNr := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber)
1154+
return ethapi.DoEstimateGas(ctx, p.r.backend, args.Data, pendingBlockNr, p.r.backend.RPCGasCap())
11551155
}
11561156

11571157
// Resolver is the top-level object in the GraphQL hierarchy.

internal/ethapi/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,7 @@ func DoEstimateGas(ctx context.Context, b Backend, args TransactionArgs, blockNr
12171217
// EstimateGas returns an estimate of the amount of gas needed to execute the
12181218
// given transaction against the current pending block.
12191219
func (s *BlockChainAPI) EstimateGas(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error) {
1220-
bNrOrHash := rpc.BlockNumberOrHashWithNumber(rpc.LatestBlockNumber)
1220+
bNrOrHash := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber)
12211221
if blockNrOrHash != nil {
12221222
bNrOrHash = *blockNrOrHash
12231223
}

0 commit comments

Comments
 (0)