Revert "core, txpool: less allocations when handling transactions (#21232)"
Reverting because this change started handling account balances as
uint64 in the transaction pool, which is incorrect.
This reverts commit af5c97aebe
.
This commit is contained in:
@ -18,7 +18,6 @@ package math
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/bits"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
@ -88,12 +87,13 @@ func SafeSub(x, y uint64) (uint64, bool) {
|
||||
|
||||
// SafeAdd returns the result and whether overflow occurred.
|
||||
func SafeAdd(x, y uint64) (uint64, bool) {
|
||||
sum, carry := bits.Add64(x, y, 0)
|
||||
return sum, carry != 0
|
||||
return x + y, y > MaxUint64-x
|
||||
}
|
||||
|
||||
// SafeMul returns multiplication result and whether overflow occurred.
|
||||
func SafeMul(x, y uint64) (uint64, bool) {
|
||||
hi, lo := bits.Mul64(x, y)
|
||||
return lo, hi != 0
|
||||
if x == 0 || y == 0 {
|
||||
return 0, false
|
||||
}
|
||||
return x * y, y > MaxUint64/x
|
||||
}
|
||||
|
Reference in New Issue
Block a user