Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions shared/services/beacon/client/std-http-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ func (c *StandardHttpClient) GetValidatorStatuses(pubkeys []types.ValidatorPubke

// Get whether validators have sync duties to perform at given epoch
func (c *StandardHttpClient) GetValidatorSyncDuties(indices []string, epoch uint64) (map[string]bool, error) {
// Return if there are not validators to check
// Return if there are no validators to check
if len(indices) == 0 {
return nil, nil
}
Expand Down Expand Up @@ -859,11 +859,14 @@ func (c *StandardHttpClient) getValidatorBalances(stateId string, indices []stri

// Get validators
func (c *StandardHttpClient) getValidators(stateId string, pubkeys []string) (ValidatorsResponse, error) {
var query string
if len(pubkeys) > 0 {
query = fmt.Sprintf("?id=%s", strings.Join(pubkeys, ","))

// Build the post body matching the Beacon API spec:
// { "ids": ["pubkey1", "pubkey2", ...], "statuses": [] }
postBody := map[string][]string{
"ids": pubkeys,
"statuses": []string{},
}
responseBody, status, err := c.getRequest(fmt.Sprintf(RequestValidatorsPath, stateId) + query)
responseBody, status, err := c.postRequest(fmt.Sprintf(RequestValidatorsPath, stateId), postBody)
if err != nil {
return ValidatorsResponse{}, fmt.Errorf("Could not get validators: %w", err)
}
Expand Down
Loading