From 5e56c9db299c229181873411362873745cdbf893 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 23 Jun 2020 19:41:55 +0300 Subject: [PATCH] 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. --- pkg/core/native/native_neo.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/core/native/native_neo.go b/pkg/core/native/native_neo.go index b8a03ba85..fcd256137 100644 --- a/pkg/core/native/native_neo.go +++ b/pkg/core/native/native_neo.go @@ -162,7 +162,7 @@ func (n *NEO) increaseBalance(ic *interop.Context, h util.Uint160, si *state.Sto return nil } 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 } siVC := ic.DAO.GetStorageItem(n.ContractID, validatorsCountKey)