From c62a4508022546e9d670e348ea366ad29b6dcc4c Mon Sep 17 00:00:00 2001 From: cheatfate Date: Tue, 27 Sep 2022 14:04:07 +0300 Subject: [PATCH] Fix validator's activity api handler. --- beacon_chain/validator_client/api.nim | 29 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/beacon_chain/validator_client/api.nim b/beacon_chain/validator_client/api.nim index ff46537b7..24401be15 100644 --- a/beacon_chain/validator_client/api.nim +++ b/beacon_chain/validator_client/api.nim @@ -1937,18 +1937,23 @@ proc getValidatorsActivity*( let resp = vc.onceToAll(RestPlainResponse, SlotDuration, {BeaconNodeRole.Duties}, getValidatorsActivity(it, epoch, validators)) - case resp.status - of ApiOperation.Timeout: - debug "Unable to perform validator's activity request in time", - timeout = SlotDuration - return GetValidatorsActivityResponse() - of ApiOperation.Interrupt: - debug "Validator's activity request was interrupted" - return GetValidatorsActivityResponse() - of ApiOperation.Failure: - debug "Unexpected error happened while receiving validator's activity" - return GetValidatorsActivityResponse() - of ApiOperation.Success: + if len(resp.data) == 0: + case resp.status + of ApiOperation.Success: + # This should not be happened, there should be present at least one + # successfull response. + return GetValidatorsActivityResponse() + of ApiOperation.Timeout: + debug "Unable to perform validator's activity request in time", + timeout = SlotDuration + return GetValidatorsActivityResponse() + of ApiOperation.Interrupt: + debug "Validator's activity request was interrupted" + return GetValidatorsActivityResponse() + of ApiOperation.Failure: + debug "Unexpected error happened while receiving validator's activity" + return GetValidatorsActivityResponse() + else: var activities: seq[RestActivityItem] for apiResponse in resp.data: if apiResponse.data.isErr():