Skip to content

Commit

Permalink
fix: ensure we generate staker operators for successful rewards
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmcgary committed Jan 2, 2025
1 parent 4f14a82 commit 3a9b4bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/rewards/rewards.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func (rc *RewardsCalculator) GetMaxSnapshotDateForCutoffDate(cutoffDate string)

func (rc *RewardsCalculator) BackfillAllStakerOperators() error {
var generatedSnapshots []storage.GeneratedRewardsSnapshots
query := `select * from generated_rewards_snapshots order by snapshot_date asc`
query := `select * from generated_rewards_snapshots where status = 'complete' order by snapshot_date asc`
res := rc.grm.Raw(query).Scan(&generatedSnapshots)
if res.Error != nil {
rc.logger.Sugar().Errorw("Failed to get generated snapshots", "error", res.Error)
Expand Down Expand Up @@ -272,7 +272,7 @@ func (rc *RewardsCalculator) BackfillAllStakerOperators() error {
func (rc *RewardsCalculator) GenerateStakerOperatorsTableForPastSnapshot(cutoffDate string) error {
// find the first snapshot that is >= to the provided cutoff date
var generatedSnapshot storage.GeneratedRewardsSnapshots
query := `select * from generated_rewards_snapshots where snapshot_date >= ? order by snapshot_date asc limit 1`
query := `select * from generated_rewards_snapshots where snapshot_date >= ? and status = 'complete' order by snapshot_date asc limit 1`
res := rc.grm.Raw(query, cutoffDate).Scan(&generatedSnapshot)
if res.Error != nil && errors.Is(res.Error, gorm.ErrRecordNotFound) {
rc.logger.Sugar().Errorw("Failed to get generated snapshot", "error", res.Error)
Expand Down

0 comments on commit 3a9b4bc

Please sign in to comment.