core: drop NEP5 tracker data if balance is zero

Makes no sense storing it and returning to the user (C# plugin doesn't do
that).
This commit is contained in:
Roman Khimov 2021-02-16 16:30:11 +03:00
parent d4f26fe473
commit 38842531ca

View file

@ -945,8 +945,12 @@ func (bc *Blockchain) processNEP5Transfer(cache *dao.Cached, transfer *state.NEP
}
bs := balances.Trackers[transfer.Asset]
bs.Balance -= transfer.Amount
bs.LastUpdatedBlock = transfer.Block
balances.Trackers[transfer.Asset] = bs
if bs.Balance != 0 {
bs.LastUpdatedBlock = transfer.Block
balances.Trackers[transfer.Asset] = bs
} else {
delete(balances.Trackers, transfer.Asset)
}
transfer.Amount = -transfer.Amount
isBig, err := cache.AppendNEP5Transfer(transfer.From, balances.NextTransferBatch, transfer)