native: avoid allocations in increaseBalance
This commit is contained in:
parent
ffeb3b8473
commit
a003879b84
2 changed files with 2 additions and 2 deletions
|
@ -54,7 +54,7 @@ func (g *GAS) increaseBalance(_ *interop.Context, _ util.Uint160, si *state.Stor
|
|||
err = errors.New("insufficient funds")
|
||||
}
|
||||
return err
|
||||
} else if sign == -1 && acc.Balance.Cmp(new(big.Int).Neg(amount)) == -1 {
|
||||
} else if sign == -1 && acc.Balance.CmpAbs(amount) == -1 {
|
||||
return errors.New("insufficient funds")
|
||||
}
|
||||
acc.Balance.Add(&acc.Balance, amount)
|
||||
|
|
|
@ -405,7 +405,7 @@ func (n *NEO) increaseBalance(ic *interop.Context, h util.Uint160, si *state.Sto
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (amount.Sign() == -1 && acc.Balance.Cmp(new(big.Int).Neg(amount)) == -1) ||
|
||||
if (amount.Sign() == -1 && acc.Balance.CmpAbs(amount) == -1) ||
|
||||
(amount.Sign() == 0 && checkBal != nil && acc.Balance.Cmp(checkBal) == -1) {
|
||||
return errors.New("insufficient funds")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue