mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-13 15:45:01 +00:00
core: record transfers even if 'from' balance is 0
Transfer events should still be saved even if balance tracking goes wild.
This commit is contained in:
parent
4a2bdf5ddc
commit
663f10192f
1 changed files with 8 additions and 9 deletions
|
@ -945,9 +945,7 @@ func (bc *Blockchain) processNEP5Transfer(cache *dao.Cached, transfer *state.NEP
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
bs := balances.Trackers[transfer.Asset]
|
bs := balances.Trackers[transfer.Asset]
|
||||||
if bs.Balance == nil {
|
if bs.Balance != nil {
|
||||||
return
|
|
||||||
}
|
|
||||||
bs.Balance.Sub(bs.Balance, transfer.Amount)
|
bs.Balance.Sub(bs.Balance, transfer.Amount)
|
||||||
if bs.Balance.Sign() > 0 {
|
if bs.Balance.Sign() > 0 {
|
||||||
bs.LastUpdatedBlock = transfer.Block
|
bs.LastUpdatedBlock = transfer.Block
|
||||||
|
@ -955,6 +953,7 @@ func (bc *Blockchain) processNEP5Transfer(cache *dao.Cached, transfer *state.NEP
|
||||||
} else {
|
} else {
|
||||||
delete(balances.Trackers, transfer.Asset)
|
delete(balances.Trackers, transfer.Asset)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
transfer.Amount.Neg(transfer.Amount)
|
transfer.Amount.Neg(transfer.Amount)
|
||||||
isBig, err := cache.AppendNEP5Transfer(transfer.From, balances.NextTransferBatch, transfer)
|
isBig, err := cache.AppendNEP5Transfer(transfer.From, balances.NextTransferBatch, transfer)
|
||||||
|
|
Loading…
Reference in a new issue