mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-23 13:38:35 +00:00
native: fix a bug in GetCommitteeMembers
Return standby committee instead of validators.
This commit is contained in:
parent
b0c051b817
commit
dce456f77f
2 changed files with 7 additions and 2 deletions
|
@ -485,13 +485,13 @@ func (n *NEO) GetCommitteeMembers(bc blockchainer.Blockchainer, d dao.DAO) (keys
|
||||||
votersCount.Mul(votersCount, big.NewInt(effectiveVoterTurnout))
|
votersCount.Mul(votersCount, big.NewInt(effectiveVoterTurnout))
|
||||||
voterTurnout := votersCount.Div(votersCount, n.getTotalSupply(d))
|
voterTurnout := votersCount.Div(votersCount, n.getTotalSupply(d))
|
||||||
if voterTurnout.Sign() != 1 {
|
if voterTurnout.Sign() != 1 {
|
||||||
return bc.GetStandByValidators(), nil
|
return bc.GetStandByCommittee(), nil
|
||||||
}
|
}
|
||||||
cs, err := n.getCandidates(d)
|
cs, err := n.getCandidates(d)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
sbVals := bc.GetStandByValidators()
|
sbVals := bc.GetStandByCommittee()
|
||||||
count := len(sbVals)
|
count := len(sbVals)
|
||||||
if len(cs) < count {
|
if len(cs) < count {
|
||||||
return sbVals, nil
|
return sbVals, nil
|
||||||
|
|
|
@ -83,6 +83,11 @@ func TestNEO_Vote(t *testing.T) {
|
||||||
ic.VM.Load(priv.PublicKey().GetVerificationScript())
|
ic.VM.Load(priv.PublicKey().GetVerificationScript())
|
||||||
require.NoError(t, neo.VoteInternal(ic, h, candidates[0]))
|
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)
|
pubs, err = neo.GetValidatorsInternal(bc, ic.DAO)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
sortedCandidates := candidates.Copy()
|
sortedCandidates := candidates.Copy()
|
||||||
|
|
Loading…
Reference in a new issue