core/txpool: apply diff

This commit is contained in:
MariusVanDerWijden 2025-09-09 14:45:31 +02:00
parent ab137eafad
commit 239738be19

View file

@ -323,8 +323,6 @@ func (l *list) Add(tx *types.Transaction, priceBump uint64) (bool, *types.Transa
if tx.GasFeeCapIntCmp(thresholdFeeCap) < 0 || tx.GasTipCapIntCmp(thresholdTip) < 0 { if tx.GasFeeCapIntCmp(thresholdFeeCap) < 0 || tx.GasTipCapIntCmp(thresholdTip) < 0 {
return false, nil return false, nil
} }
// Old is being replaced, subtract old cost
l.subTotalCost([]*types.Transaction{old})
} }
// Add new tx cost to totalcost // Add new tx cost to totalcost
cost, overflow := uint256.FromBig(tx.Cost()) cost, overflow := uint256.FromBig(tx.Cost())
@ -337,6 +335,9 @@ func (l *list) Add(tx *types.Transaction, priceBump uint64) (bool, *types.Transa
} }
l.totalcost = total l.totalcost = total
// Old is being replaced, subtract old cost
l.subTotalCost([]*types.Transaction{old})
// Otherwise overwrite the old transaction with the current one // Otherwise overwrite the old transaction with the current one
l.txs.Put(tx) l.txs.Put(tx)
if l.costcap.Cmp(cost) < 0 { if l.costcap.Cmp(cost) < 0 {