|
|
@@ -1051,9 +1051,12 @@ func DoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrOrHash
|
|
|
|
|
|
// EstimateGas returns an estimate of the amount of gas needed to execute the
|
|
|
// given transaction against the current pending block.
|
|
|
-func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs) (hexutil.Uint64, error) {
|
|
|
- blockNrOrHash := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber)
|
|
|
- return DoEstimateGas(ctx, s.b, args, blockNrOrHash, s.b.RPCGasCap())
|
|
|
+func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error) {
|
|
|
+ bNrOrHash := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber)
|
|
|
+ if blockNrOrHash != nil {
|
|
|
+ bNrOrHash = *blockNrOrHash
|
|
|
+ }
|
|
|
+ return DoEstimateGas(ctx, s.b, args, bNrOrHash, s.b.RPCGasCap())
|
|
|
}
|
|
|
|
|
|
// ExecutionResult groups all structured logs emitted by the EVM
|