rpc: answer with zero-length when there are no registered validators

There is a huge difference between
   "result" : [],
and
   "result" : null,
This commit is contained in:
Roman Khimov 2020-08-10 17:50:19 +03:00
parent f287681fa7
commit 6e252fbaae

View file

@ -856,7 +856,7 @@ func (s *Server) getValidators(_ request.Params) (interface{}, *response.Error)
if err != nil {
return nil, response.NewRPCError("can't get enrollments", "", err)
}
var res []result.Validator
var res = make([]result.Validator, 0)
for _, v := range enrollments {
res = append(res, result.Validator{
PublicKey: *v.Key,