mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 21:26:42 +00:00
core/txpool: add sanity overflow check
This commit is contained in:
parent
1263f3dfc1
commit
ab137eafad
1 changed files with 5 additions and 1 deletions
|
|
@ -331,7 +331,11 @@ func (l *list) Add(tx *types.Transaction, priceBump uint64) (bool, *types.Transa
|
|||
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
|
||||
|
||||
// Otherwise overwrite the old transaction with the current one
|
||||
l.txs.Put(tx)
|
||||
|
|
|
|||
Loading…
Reference in a new issue