From bb7b5f1e3332027a26800358a0e2b453ffa2bed2 Mon Sep 17 00:00:00 2001 From: Venkatesh Mankena Date: Wed, 30 Jun 2021 23:01:47 +0530 Subject: [PATCH] If lastCheckedBlockheight is zero, Set it to height at which peggy contract is deployed --- orchestrator/main_loops.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/orchestrator/main_loops.go b/orchestrator/main_loops.go index de9dce4b..2b48e007 100644 --- a/orchestrator/main_loops.go +++ b/orchestrator/main_loops.go @@ -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)