mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-05 03:58:23 +00:00
Merge pull request #1901 from nspcc-dev/nep5-tracking-fixes
NEP5 tracking fixes
This commit is contained in:
commit
d8c8593410
2 changed files with 11 additions and 9 deletions
|
@ -945,15 +945,14 @@ func (bc *Blockchain) processNEP5Transfer(cache *dao.Cached, transfer *state.NEP
|
|||
return
|
||||
}
|
||||
bs := balances.Trackers[transfer.Asset]
|
||||
if bs.Balance == nil {
|
||||
return
|
||||
}
|
||||
bs.Balance.Sub(bs.Balance, transfer.Amount)
|
||||
if bs.Balance.Sign() > 0 {
|
||||
bs.LastUpdatedBlock = transfer.Block
|
||||
balances.Trackers[transfer.Asset] = bs
|
||||
} else {
|
||||
delete(balances.Trackers, transfer.Asset)
|
||||
if bs.Balance != nil {
|
||||
bs.Balance.Sub(bs.Balance, transfer.Amount)
|
||||
if bs.Balance.Sign() > 0 {
|
||||
bs.LastUpdatedBlock = transfer.Block
|
||||
balances.Trackers[transfer.Asset] = bs
|
||||
} else {
|
||||
delete(balances.Trackers, transfer.Asset)
|
||||
}
|
||||
}
|
||||
|
||||
transfer.Amount.Neg(transfer.Amount)
|
||||
|
|
|
@ -188,6 +188,9 @@ func NEP5TransferFromNotification(ne NotificationEvent, txHash util.Uint256, hei
|
|||
if !ok {
|
||||
return nil, errors.New("wrong amount type")
|
||||
}
|
||||
if len(bs) > amountSize {
|
||||
return nil, errors.New("integer overflow")
|
||||
}
|
||||
amount = emit.BytesToInt(bs)
|
||||
}
|
||||
toAddr := parseUint160(to)
|
||||
|
|
Loading…
Reference in a new issue