Skip to content

Commit

Permalink
chore: use correct epoch number
Browse files Browse the repository at this point in the history
  • Loading branch information
onmax committed Nov 19, 2024
1 parent 22ec0c8 commit 853f378
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions server/api/[version]/validators/index.get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default defineCachedEventHandler(async (event) => {

let addresses: string[] = []

let epochNumber = 1
const epochNumber = 1

// In case server is offline, at least we can show the database data
if (isOnline) {
Expand All @@ -33,10 +33,10 @@ export default defineCachedEventHandler(async (event) => {
consola.warn(`Error calculating scores for range ${JSON.stringify(range)}`, error)
}

const { data: _epochNumber, error: errorEpochNumber } = await getRpcClient().blockchain.getEpochNumber()
if (errorEpochNumber)
throw createError(errorEpochNumber)
epochNumber = _epochNumber - 1
const { data: epochNumber, error: errorEpochNumber } = await getRpcClient().blockchain.getEpochNumber()
if (errorEpochNumber || !epochNumber)
throw createError(errorEpochNumber || 'Epoch number not found')
// epochNumber = _epochNumber - 1
}

const { data: validators, error: errorValidators } = await fetchValidators({ ...params, addresses, epochNumber })
Expand Down

0 comments on commit 853f378

Please sign in to comment.