mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
internal/ethapi: use block GasLimit if gas is nil in DoEstimateGas
This commit is contained in:
parent
34aac1d756
commit
2767f16b69
1 changed files with 6 additions and 0 deletions
|
|
@ -1182,6 +1182,12 @@ func DoEstimateGas(ctx context.Context, b Backend, args TransactionArgs, blockNr
|
||||||
State: state,
|
State: state,
|
||||||
ErrorRatio: estimateGasErrorRatio,
|
ErrorRatio: estimateGasErrorRatio,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the user has not specified a gas limit, use the block gas limit
|
||||||
|
if args.Gas == nil {
|
||||||
|
args.Gas = new(hexutil.Uint64)
|
||||||
|
*args.Gas = hexutil.Uint64(header.GasLimit)
|
||||||
|
}
|
||||||
if err := args.CallDefaults(gasCap, header.BaseFee, b.ChainConfig().ChainID); err != nil {
|
if err := args.CallDefaults(gasCap, header.BaseFee, b.ChainConfig().ChainID); err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue