diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index 8bb1b0b9a..1e56785cc 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -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 } diff --git a/pkg/rpc/server/server_test.go b/pkg/rpc/server/server_test.go index 698dbfe23..4902396ba 100644 --- a/pkg/rpc/server/server_test.go +++ b/pkg/rpc/server/server_test.go @@ -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, }) }