core/txpool: add sanity overflow check

This commit is contained in:
MariusVanDerWijden 2025-09-04 21:22:30 +02:00
parent 1263f3dfc1
commit ab137eafad

View file

@ -331,7 +331,11 @@ func (l *list) Add(tx *types.Transaction, priceBump uint64) (bool, *types.Transa
if overflow { if overflow {
return false, nil 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
// 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)