Skip to content

Commit

Permalink
(NOBIDS) fix error when first slot of stats day is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbitfly committed Nov 14, 2023
1 parent 4c3a400 commit bc91f8c
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 bc91f8c

Please sign in to comment.