native: save balance value in storage for failed transfers

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgeniy Stratonikov 2021-07-01 18:44:00 +03:00
parent e3323faf69
commit a7722f0fa5

View file

@ -195,6 +195,9 @@ func (c *nep17TokenNative) updateAccBalance(ic *interop.Context, acc util.Uint16
err := c.incBalance(ic, acc, &si, amount) err := c.incBalance(ic, acc, &si, amount)
if err != nil { if err != nil {
if si != nil && amount.Sign() < 0 {
_ = ic.DAO.PutStorageItem(c.ID, key, si)
}
return err return err
} }
if si == nil { if si == nil {