Skip to content

Commit

Permalink
Fix panic in caplin api get validator (#11419) (#11583)
Browse files Browse the repository at this point in the history
Fix #11414 
root cause: empty validator set
  • Loading branch information
domiwei authored Aug 13, 2024
1 parent aa6c7e6 commit 2661ad3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cl/beacon/handler/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,12 +404,19 @@ func (a *ApiHandler) GetEthV1BeaconStatesValidator(w http.ResponseWriter, r *htt
if err != nil {
return nil, err
}
if validatorSet == nil {
return nil, beaconhttp.NewEndpointError(http.StatusNotFound, errors.New("validators not found"))
}
balances, err := a.stateReader.ReadValidatorsBalances(tx, *slot)
if err != nil {
return nil, err
}
if balances == nil {
return nil, beaconhttp.NewEndpointError(http.StatusNotFound, errors.New("balances not found"))
}
return responseValidator(validatorIndex, stateEpoch, balances, validatorSet, true)
}

balances, err := a.forkchoiceStore.GetBalances(blockRoot)
if err != nil {
return nil, err
Expand Down

0 comments on commit 2661ad3

Please sign in to comment.