From e974d96977f13742c28f9eb69e8d539bf36e4551 Mon Sep 17 00:00:00 2001 From: Daniel Liu <139250065@qq.com> Date: Mon, 21 Apr 2025 16:11:43 +0800 Subject: [PATCH] core/txpool: accept non-local transaction with zero tip (#950) --- core/txpool/txpool.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/txpool/txpool.go b/core/txpool/txpool.go index 2061569247..7151ecf8f6 100644 --- a/core/txpool/txpool.go +++ b/core/txpool/txpool.go @@ -568,7 +568,7 @@ func (pool *TxPool) Pending(enforceTips bool) map[common.Address]types.Transacti txs := list.Flatten() // If the miner requests tip enforcement, cap the lists now - if enforceTips && !pool.locals.contains(addr) { + if enforceTips && pool.priced.urgent.baseFee != nil && !pool.locals.contains(addr) { for i, tx := range txs { if !tx.IsSpecialTransaction() && tx.GasPrice().Cmp(pool.priced.urgent.baseFee) < 0 { txs = txs[:i] @@ -664,8 +664,15 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { return ErrInvalidSender } // Drop non-local transactions under our own minimal accepted gas price or tip - if !local && tx.GasTipCapIntCmp(pool.gasPrice) < 0 { - if !tx.IsSpecialTransaction() || (pool.IsSigner != nil && !pool.IsSigner(from)) { + if !local { + isUnderpriced := false + if pool.priced.urgent.baseFee != nil { + // check tx.GasPrice() when GasTipCap() == 0 + isUnderpriced = tx.GasPrice().Cmp(pool.priced.urgent.baseFee) < 0 + } else { + isUnderpriced = tx.GasTipCapIntCmp(pool.gasPrice) < 0 + } + if isUnderpriced && (!tx.IsSpecialTransaction() || (pool.IsSigner != nil && !pool.IsSigner(from))) { return ErrUnderpriced } }