Skip to content

Commit

Permalink
Fix dry run by wrapping epoch indexed update (#483)
Browse files Browse the repository at this point in the history
  • Loading branch information
pharr117 authored Sep 19, 2023
1 parent 1a4f47d commit 082e970
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions db/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,16 @@ func IndexBlockEvents(db *gorm.DB, dryRun bool, blockHeight int64, blockTime tim
}

func UpdateEpochIndexingStatus(db *gorm.DB, dryRun bool, epochNumber uint, epochIdentifier string, dbChainID string, dbChainName string) error {
epochToUpdate := Epoch{
EpochNumber: epochNumber,
Chain: Chain{ChainID: dbChainID, Name: dbChainName},
Identifier: epochIdentifier,
}
if !dryRun {
epochToUpdate := Epoch{
EpochNumber: epochNumber,
Chain: Chain{ChainID: dbChainID, Name: dbChainName},
Identifier: epochIdentifier,
}

return db.Model(&Epoch{}).Where(&epochToUpdate).Update("indexed", true).Error
return db.Model(&Epoch{}).Where(&epochToUpdate).Update("indexed", true).Error
}
return nil
}

func createTaxableEvents(db *gorm.DB, events []TaxableEvent) error {
Expand Down

0 comments on commit 082e970

Please sign in to comment.