mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-04 19:19:44 +00:00
core: fix getenrollments
Make getvalidators return the same set of keys with C# for mainnet.
This commit is contained in:
parent
1ef91fa409
commit
07c91ea22d
2 changed files with 8 additions and 17 deletions
|
@ -2266,23 +2266,14 @@ func (bc *Blockchain) GetEnrollments() ([]*state.Validator, error) {
|
|||
for _, validator := range validators {
|
||||
if validator.Registered {
|
||||
result = append(result, validator)
|
||||
continue
|
||||
}
|
||||
}
|
||||
for _, sBValidator := range uniqueSBValidators {
|
||||
isAdded := false
|
||||
for _, v := range result {
|
||||
if v.PublicKey == sBValidator {
|
||||
isAdded = true
|
||||
for _, sbValidator := range uniqueSBValidators {
|
||||
if validator.PublicKey.Equal(sbValidator) {
|
||||
result = append(result, validator)
|
||||
break
|
||||
}
|
||||
}
|
||||
if !isAdded {
|
||||
result = append(result, &state.Validator{
|
||||
PublicKey: sBValidator,
|
||||
Registered: false,
|
||||
Votes: 0,
|
||||
})
|
||||
}
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -723,12 +723,12 @@ var rpcTestCases = map[string][]rpcTestCase{
|
|||
},
|
||||
check: func(t *testing.T, e *executor, validators interface{}) {
|
||||
var expected []result.Validator
|
||||
sBValidators, err := e.chain.GetStandByValidators()
|
||||
enrolls, err := e.chain.GetEnrollments()
|
||||
require.NoError(t, err)
|
||||
for _, sbValidator := range sBValidators {
|
||||
for _, validator := range enrolls {
|
||||
expected = append(expected, result.Validator{
|
||||
PublicKey: *sbValidator,
|
||||
Votes: 0,
|
||||
PublicKey: *validator.PublicKey,
|
||||
Votes: validator.Votes,
|
||||
Active: true,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue