native: fix a bug in GetCommitteeMembers

Return standby committee instead of validators.
This commit is contained in:
Evgenii Stratonikov 2020-08-27 18:05:26 +03:00
parent b0c051b817
commit dce456f77f
2 changed files with 7 additions and 2 deletions

View file

@ -485,13 +485,13 @@ func (n *NEO) GetCommitteeMembers(bc blockchainer.Blockchainer, d dao.DAO) (keys
votersCount.Mul(votersCount, big.NewInt(effectiveVoterTurnout))
voterTurnout := votersCount.Div(votersCount, n.getTotalSupply(d))
if voterTurnout.Sign() != 1 {
return bc.GetStandByValidators(), nil
return bc.GetStandByCommittee(), nil
}
cs, err := n.getCandidates(d)
if err != nil {
return nil, err
}
sbVals := bc.GetStandByValidators()
sbVals := bc.GetStandByCommittee()
count := len(sbVals)
if len(cs) < count {
return sbVals, nil

View file

@ -83,6 +83,11 @@ func TestNEO_Vote(t *testing.T) {
ic.VM.Load(priv.PublicKey().GetVerificationScript())
require.NoError(t, neo.VoteInternal(ic, h, candidates[0]))
for i := testchain.ValidatorsCount; i < testchain.CommitteeSize(); i++ {
priv := testchain.PrivateKey(i)
require.NoError(t, neo.RegisterCandidateInternal(ic, priv.PublicKey()))
}
pubs, err = neo.GetValidatorsInternal(bc, ic.DAO)
require.NoError(t, err)
sortedCandidates := candidates.Copy()