Skip to content

Commit

Permalink
Filters are always a object
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig committed Dec 5, 2023
1 parent e1964ee commit b9c78b5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/beacon-node/src/api/impl/beacon/state/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export function getBeaconStateApi({
data: validatorResponses,
meta: {executionOptimistic},
};
} else if (filters?.status) {
} else if (filters.status) {
const validatorsByStatus = filterStateValidatorsByStatus(filters.status, state, pubkey2index, currentEpoch);
return {
data: validatorsByStatus,
Expand Down Expand Up @@ -191,17 +191,17 @@ export function getBeaconStateApi({
throw new ApiError(400, `No cached state available for stateId: ${stateId}`);
}

const epoch = filters?.epoch ?? computeEpochAtSlot(state.slot);
const epoch = filters.epoch ?? computeEpochAtSlot(state.slot);
const startSlot = computeStartSlotAtEpoch(epoch);
const shuffling = stateCached.epochCtx.getShufflingAtEpoch(epoch);
const committees = shuffling.committees;
const committeesFlat = committees.flatMap((slotCommittees, slotInEpoch) => {
const slot = startSlot + slotInEpoch;
if (filters?.slot !== undefined && filters.slot !== slot) {
if (filters.slot !== undefined && filters.slot !== slot) {
return [];
}
return slotCommittees.flatMap((committee, committeeIndex) => {
if (filters?.index !== undefined && filters.index !== committeeIndex) {
if (filters.index !== undefined && filters.index !== committeeIndex) {
return [];
}
return [
Expand Down

0 comments on commit b9c78b5

Please sign in to comment.