Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions core/txpool/legacypool/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,15 +323,22 @@ func (l *list) Add(tx *types.Transaction, priceBump uint64) (bool, *types.Transa
if tx.GasFeeCapIntCmp(thresholdFeeCap) < 0 || tx.GasTipCapIntCmp(thresholdTip) < 0 {
return false, nil
}
// Old is being replaced, subtract old cost
l.subTotalCost([]*types.Transaction{old})
}
// Add new tx cost to totalcost
cost, overflow := uint256.FromBig(tx.Cost())
if overflow {
return false, nil
}
l.totalcost.Add(l.totalcost, cost)
total, overflow := new(uint256.Int).AddOverflow(l.totalcost, cost)
if overflow {
return false, nil
}
l.totalcost = total

// Old is being replaced, subtract old cost
if old != nil {
l.subTotalCost([]*types.Transaction{old})
}

// Otherwise overwrite the old transaction with the current one
l.txs.Put(tx)
Expand Down