Skip to content

Commit

Permalink
Merge pull request #36 from InjectiveLabs/initial_query_height
Browse files Browse the repository at this point in the history
If lastCheckedBlockheight is zero, Set it to height at which peggy co…
  • Loading branch information
albertchon authored Jun 30, 2021
2 parents 94d0f48 + bb7b5f1 commit 10921b5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions orchestrator/main_loops.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ func (s *peggyOrchestrator) EthOracleMainLoop(ctx context.Context) (err error) {

if err := retry.Do(func() (err error) {
lastCheckedBlock, err = s.GetLastCheckedBlock(ctx)
if lastCheckedBlock == 0 {
peggyParams, err := s.cosmosQueryClient.PeggyParams(ctx)
if err != nil {
log.WithError(err).Fatalln("failed to query peggy params, is injectived running?")
}
lastCheckedBlock = peggyParams.BridgeContractStartHeight
}
return
}, retry.Context(ctx), retry.OnRetry(func(n uint, err error) {
logger.WithError(err).Warningf("failed to get last checked block, will retry (%d)", n)
Expand Down

0 comments on commit 10921b5

Please sign in to comment.