Skip to content

Commit 2661ad3

Browse files
authored
Fix panic in caplin api get validator (#11419) (#11583)
Fix #11414 root cause: empty validator set
1 parent aa6c7e6 commit 2661ad3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cl/beacon/handler/validators.go

+7
Original file line numberDiff line numberDiff line change
@@ -404,12 +404,19 @@ func (a *ApiHandler) GetEthV1BeaconStatesValidator(w http.ResponseWriter, r *htt
404404
if err != nil {
405405
return nil, err
406406
}
407+
if validatorSet == nil {
408+
return nil, beaconhttp.NewEndpointError(http.StatusNotFound, errors.New("validators not found"))
409+
}
407410
balances, err := a.stateReader.ReadValidatorsBalances(tx, *slot)
408411
if err != nil {
409412
return nil, err
410413
}
414+
if balances == nil {
415+
return nil, beaconhttp.NewEndpointError(http.StatusNotFound, errors.New("balances not found"))
416+
}
411417
return responseValidator(validatorIndex, stateEpoch, balances, validatorSet, true)
412418
}
419+
413420
balances, err := a.forkchoiceStore.GetBalances(blockRoot)
414421
if err != nil {
415422
return nil, err

0 commit comments

Comments
 (0)