Skip to content

Commit

Permalink
Merge pull request #2699 from gobitfly/NOBIDS/bugfix_first_stats_day_…
Browse files Browse the repository at this point in the history
…slot_empty

(NOBIDS) fix error when first slot of stats day is empty
  • Loading branch information
peterbitfly authored Nov 14, 2023
2 parents 4c3a400 + bc91f8c commit a517615
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -1969,7 +1969,7 @@ func GetSlotVizData(latestEpoch uint64) ([]*types.SlotVizEpochs, error) {
}

func GetBlockNumber(slot uint64) (block uint64, err error) {
err = ReaderDb.Get(&block, `SELECT exec_block_number FROM blocks where slot = $1`, slot)
err = ReaderDb.Get(&block, `SELECT exec_block_number FROM blocks where slot >= $1 AND exec_block_number > 0 ORDER BY slot LIMIT 1`, slot)
return
}

Expand Down
2 changes: 1 addition & 1 deletion db/statistics.go
Original file line number Diff line number Diff line change
Expand Up @@ -1494,7 +1494,7 @@ func WriteExecutionChartSeriesForDay(day int64) error {
}

if firstBlock <= 15537394 {
return fmt.Errorf("this function does not yet handle pre merge statistics")
return fmt.Errorf("this function does not yet handle pre merge statistics, firstBlock is %v, firstSlot is %v", firstBlock, firstSlot)
}

lastBlock, err := GetBlockNumber(uint64(lastSlot))
Expand Down

0 comments on commit a517615

Please sign in to comment.