Skip to content

Commit

Permalink
core: check effective tip in txpool pricelimit validation (ethereum#2…
Browse files Browse the repository at this point in the history
…3855)

The price limit is supposed to exclude transactions with too low fee
amount. Before EIP-1559, it was sufficient to check the limit against
the gas price of the transaction. After 1559, it is more complicated
because the concept of 'transaction gas price' does not really exist.

When mining, the price limit is used to exclude transactions below a
certain effective fee amount. This change makes it apply the same check
earlier, in tx validation. Transactions below the specified fee amount
cannot enter the pool.

Fixes ethereum#23837
  • Loading branch information
fjl committed Nov 8, 2021
1 parent ad11691 commit 9489853
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/tx_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,9 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
if err != nil {
return ErrInvalidSender
}
// Drop non-local transactions under our own minimal accepted gas price or tip
if !local && tx.GasTipCapIntCmp(pool.gasPrice) < 0 {
// Drop non-local transactions under our own minimal accepted gas price or tip.
pendingBaseFee := pool.priced.urgent.baseFee
if !local && tx.EffectiveGasTipIntCmp(pool.gasPrice, pendingBaseFee) < 0 {
return ErrUnderpriced
}
// Ensure the transaction adheres to nonce ordering
Expand Down

0 comments on commit 9489853

Please sign in to comment.