Skip to content

Commit

Permalink
Merge pull request #2855 from gobitfly/NOBIDS/improve-validator-page
Browse files Browse the repository at this point in the history
(NOBIDS) improve validator-page sync-committee-stats-gathering
  • Loading branch information
recy21 authored Mar 26, 2024
2 parents 1e6a709 + af23caf commit a4cac59
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions handlers/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -731,16 +731,15 @@ func Validator(w http.ResponseWriter, r *http.Request) {
if len(actualSyncPeriods) > 0 {
// get sync stats from validator_stats
syncStats := types.SyncCommitteesStats{}
// check if validator has been active in the last exported stats day
if lastStatsDay > 0 && validatorPageData.ActivationEpoch <= lastStatsDay*utils.EpochsPerDay() {
if lastStatsDay > 0 {
err = db.ReaderDb.Get(&syncStats, `
SELECT
COALESCE(participated_sync_total, 0) AS participated_sync,
COALESCE(missed_sync_total, 0) AS missed_sync,
COALESCE(orphaned_sync_total, 0) AS orphaned_sync
FROM validator_stats
WHERE validatorindex = $1 AND day = $2`, index, lastStatsDay)
if err != nil {
if err != nil && err != sql.ErrNoRows {
return fmt.Errorf("error getting validator syncStats: %w", err)
}
}
Expand Down

0 comments on commit a4cac59

Please sign in to comment.