mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
internal/ethapi: recap higher args.Gas with block GasLimit in DoEstimateGas
This commit is contained in:
parent
eeb22089fd
commit
97a4b1257c
1 changed files with 5 additions and 0 deletions
|
|
@ -1202,6 +1202,11 @@ func DoEstimateGas(ctx context.Context, b Backend, args TransactionArgs, blockNr
|
|||
if err := args.CallDefaults(gasCap, header.BaseFee, b.ChainConfig().ChainID); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
// when gas is over header.GasLimit, just recap with header.GasLimit
|
||||
if uint64(*args.Gas) > header.GasLimit {
|
||||
*args.Gas = (hexutil.Uint64)(header.GasLimit)
|
||||
}
|
||||
|
||||
call := args.ToMessage(header.BaseFee)
|
||||
// Run the gas estimation andwrap any revertals into a custom return
|
||||
estimate, revert, err := gasestimator.Estimate(ctx, call, opts, gasCap)
|
||||
|
|
|
|||
Loading…
Reference in a new issue