mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 05:36:46 +00:00
Allow ErrGasLimitTooHigh errors when executing transactions for gas limit estimation to continue estimating with lower caps
This commit is contained in:
parent
9c58810e71
commit
4d1264fd08
2 changed files with 7 additions and 1 deletions
|
|
@ -65,7 +65,7 @@ var Defaults = Config{
|
||||||
Miner: miner.DefaultConfig,
|
Miner: miner.DefaultConfig,
|
||||||
TxPool: legacypool.DefaultConfig,
|
TxPool: legacypool.DefaultConfig,
|
||||||
BlobPool: blobpool.DefaultConfig,
|
BlobPool: blobpool.DefaultConfig,
|
||||||
RPCGasCap: 50000000,
|
RPCGasCap: 30000000,
|
||||||
RPCEVMTimeout: 5 * time.Second,
|
RPCEVMTimeout: 5 * time.Second,
|
||||||
GPO: FullNodeGPO,
|
GPO: FullNodeGPO,
|
||||||
RPCTxFeeCap: 1, // 1 ether
|
RPCTxFeeCap: 1, // 1 ether
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,9 @@ func Estimate(ctx context.Context, call *core.Message, opts *Options, gasCap uin
|
||||||
if call.GasLimit >= params.TxGas {
|
if call.GasLimit >= params.TxGas {
|
||||||
hi = call.GasLimit
|
hi = call.GasLimit
|
||||||
}
|
}
|
||||||
|
if hi >= params.MaxTxGas {
|
||||||
|
hi = params.MaxTxGas
|
||||||
|
}
|
||||||
// Normalize the max fee per gas the call is willing to spend.
|
// Normalize the max fee per gas the call is willing to spend.
|
||||||
var feeCap *big.Int
|
var feeCap *big.Int
|
||||||
if call.GasFeeCap != nil {
|
if call.GasFeeCap != nil {
|
||||||
|
|
@ -209,6 +212,9 @@ func execute(ctx context.Context, call *core.Message, opts *Options, gasLimit ui
|
||||||
if errors.Is(err, core.ErrIntrinsicGas) {
|
if errors.Is(err, core.ErrIntrinsicGas) {
|
||||||
return true, nil, nil // Special case, raise gas limit
|
return true, nil, nil // Special case, raise gas limit
|
||||||
}
|
}
|
||||||
|
if errors.Is(err, core.ErrGasLimitTooHigh) {
|
||||||
|
return true, nil, nil // Special case, lower gas limit
|
||||||
|
}
|
||||||
return true, nil, err // Bail out
|
return true, nil, err // Bail out
|
||||||
}
|
}
|
||||||
return result.Failed(), result, nil
|
return result.Failed(), result, nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue