mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-08 07:58:40 +00:00
core/txpool: report actual 110% threshold in intrinsic gas error
When a chain has gasCostPerStateByte != 0 (EIP-8037), the txpool admission requires tx.Gas() >= ceil(intrGas.RegularGas * 10/9), but the error message reported intrGas.RegularGas as the "minimum needed", which is the unscaled value below the real threshold. This is confusing: the user sees e.g. "gas 21000, minimum needed 21000" for a simple transfer and assumes the comparison is broken, when in fact the pool wants 23334. Compute the threshold once and report it in the error.
This commit is contained in:
parent
18025f9001
commit
075cc6417a
1 changed files with 2 additions and 2 deletions
|
|
@ -134,8 +134,8 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types
|
|||
// We require transactions to pay for 110% of intrinsic gas in order to
|
||||
// prevent situations where a change in gas limit invalidates a lot
|
||||
// of transactions in the txpool
|
||||
if tx.Gas() < (intrGas.RegularGas*10)/9 {
|
||||
return fmt.Errorf("%w: gas %v, minimum needed %v", core.ErrIntrinsicGas, tx.Gas(), intrGas.RegularGas)
|
||||
if minGas := (intrGas.RegularGas * 10) / 9; tx.Gas() < minGas {
|
||||
return fmt.Errorf("%w: gas %v, minimum needed %v", core.ErrIntrinsicGas, tx.Gas(), minGas)
|
||||
}
|
||||
}
|
||||
if tx.Gas() < intrGas.RegularGas {
|
||||
|
|
|
|||
Loading…
Reference in a new issue