native: fix voting accounting in transfers processing

We should modify votes count exactly by the amount of NEO balance change, it
might be negative here.
This commit is contained in:
Roman Khimov 2020-06-23 19:41:55 +03:00
parent 37d44b94e1
commit 5e56c9db29

View file

@ -162,7 +162,7 @@ func (n *NEO) increaseBalance(ic *interop.Context, h util.Uint160, si *state.Sto
return nil return nil
} }
if len(acc.Votes) > 0 { if len(acc.Votes) > 0 {
if err := n.ModifyAccountVotes(acc, ic.DAO, new(big.Int).Neg(&acc.Balance)); err != nil { if err := n.ModifyAccountVotes(acc, ic.DAO, amount); err != nil {
return err return err
} }
siVC := ic.DAO.GetStorageItem(n.ContractID, validatorsCountKey) siVC := ic.DAO.GetStorageItem(n.ContractID, validatorsCountKey)