From ba5f5527b1fa58236dd3065fa0b8dce804cb6394 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 8 Nov 2021 15:25:35 +0100 Subject: [PATCH] core: check effective tip in txpool pricelimit validation (#23855) 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 #23837 --- core/tx_pool.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/tx_pool.go b/core/tx_pool.go index 4dd3a19c8de7..a02f8e277de9 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -627,8 +627,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