diff --git a/txpool/pool.go b/txpool/pool.go index 43bba5a20..d1d38747d 100644 --- a/txpool/pool.go +++ b/txpool/pool.go @@ -1190,13 +1190,10 @@ func (p *TxPool) setBaseFee(baseFee uint64) (uint64, bool) { return p.pendingBaseFee.Load(), changed } -func (p *TxPool) setBlobFee(blobFee uint64) (uint64, bool) { - changed := false +func (p *TxPool) setBlobFee(blobFee uint64) { if blobFee > 0 { - changed = blobFee != p.pendingBlobFee.Load() p.pendingBaseFee.Store(blobFee) } - return p.pendingBlobFee.Load(), changed } func (p *TxPool) addLocked(mt *metaTx, announcements *types.Announcements) txpoolcfg.DiscardReason { @@ -1258,7 +1255,7 @@ func (p *TxPool) addLocked(mt *metaTx, announcements *types.Announcements) txpoo } // Don't add blob tx to queued if it's less than current pending blob base fee - if mt.Tx.Type == types.BlobTxType && mt.Tx.BlobFeeCap.Cmp(uint256.NewInt(p.pendingBlobFee.Load())) < 0 { + if mt.Tx.Type == types.BlobTxType && mt.Tx.BlobFeeCap.Uint64() < p.pendingBlobFee.Load() { return txpoolcfg.FeeTooLow } @@ -1519,7 +1516,9 @@ func onSenderStateChange(senderID uint64, senderNonce uint64, senderBalance uint func promote(pending *PendingPool, baseFee, queued *SubPool, pendingBaseFee uint64, pendingBlobFee uint64, discard func(*metaTx, txpoolcfg.DiscardReason), announcements *types.Announcements, logger log.Logger) { // Demote worst transactions that do not qualify for pending sub pool anymore, to other sub pools, or discard - for worst := pending.Worst(); pending.Len() > 0 && (worst.subPool < BaseFeePoolBits || worst.minFeeCap.Cmp(uint256.NewInt(pendingBaseFee)) < 0 || (worst.Tx.Type == types.BlobTxType && worst.Tx.BlobFeeCap.Cmp(uint256.NewInt(pendingBlobFee)) < 0)); worst = pending.Worst() { + for worst := pending.Worst(); pending.Len() > 0 && + (worst.subPool < BaseFeePoolBits || worst.minFeeCap.Uint64() < pendingBaseFee) || + (worst.Tx.Type == types.BlobTxType && worst.Tx.BlobFeeCap.Uint64() < pendingBlobFee); worst = pending.Worst() { if worst.subPool >= BaseFeePoolBits { tx := pending.PopWorst() announcements.Append(tx.Tx.Type, tx.Tx.Size, tx.Tx.IDHash[:]) @@ -1532,7 +1531,10 @@ func promote(pending *PendingPool, baseFee, queued *SubPool, pendingBaseFee uint } // Promote best transactions from base fee pool to pending pool while they qualify - for best := baseFee.Best(); baseFee.Len() > 0 && best.subPool >= BaseFeePoolBits && best.minFeeCap.Cmp(uint256.NewInt(pendingBaseFee)) >= 0 && (best.Tx.Type == types.BlobTxType && best.Tx.BlobFeeCap.Cmp(uint256.NewInt(pendingBlobFee)) >= 0 || best.Tx.Type != types.BlobTxType); best = baseFee.Best() { + for best := baseFee.Best(); baseFee.Len() > 0 && + best.subPool >= BaseFeePoolBits && best.minFeeCap.Uint64() >= pendingBaseFee && + (best.Tx.Type == types.BlobTxType && best.Tx.BlobFeeCap.Uint64() >= pendingBlobFee || + best.Tx.Type != types.BlobTxType); best = baseFee.Best() { tx := baseFee.PopBest() announcements.Append(tx.Tx.Type, tx.Tx.Size, tx.Tx.IDHash[:]) pending.Add(tx, logger)