forked from TrueCloudLab/neoneo-go
native: distribute GAS even for empty transfers
As it's one of the use cases.
This commit is contained in:
parent
064636768b
commit
36c6c6690b
1 changed files with 4 additions and 3 deletions
|
@ -158,14 +158,15 @@ func (n *NEO) increaseBalance(ic *interop.Context, h util.Uint160, si *state.Sto
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if sign := amount.Sign(); sign == 0 {
|
||||
return nil
|
||||
} else if sign == -1 && acc.Balance.Cmp(new(big.Int).Neg(amount)) == -1 {
|
||||
if amount.Sign() == -1 && acc.Balance.Cmp(new(big.Int).Neg(amount)) == -1 {
|
||||
return errors.New("insufficient funds")
|
||||
}
|
||||
if err := n.distributeGas(ic, h, acc); err != nil {
|
||||
return err
|
||||
}
|
||||
if amount.Sign() == 0 {
|
||||
return nil
|
||||
}
|
||||
acc.Balance.Add(&acc.Balance, amount)
|
||||
si.Value = acc.Bytes()
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue