Skip to content

Commit

Permalink
Skip request when there are no validators
Browse files Browse the repository at this point in the history
  • Loading branch information
0xfornax committed Oct 29, 2024
1 parent ee04277 commit 9b896cb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions shared/services/beacon/client/std-http-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,13 @@ 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) {
// Map to store results
validatorMap := make(map[string]bool)

// Return if there are not validators to check
if len(indices) == 0 {
return validatorMap, nil
}

// Perform the post request
responseBody, status, err := c.postRequest(fmt.Sprintf(RequestValidatorSyncDuties, strconv.FormatUint(epoch, 10)), indices)
Expand All @@ -329,9 +336,6 @@ func (c *StandardHttpClient) GetValidatorSyncDuties(indices []string, epoch uint
return nil, fmt.Errorf("Could not decode validator sync duties data: %w", err)
}

// Map the results
validatorMap := make(map[string]bool)

for _, index := range indices {
validatorMap[index] = false
for _, duty := range response.Data {
Expand Down

0 comments on commit 9b896cb

Please sign in to comment.