From 61f4a23b939ad92f626ed220839918e0cc1a1b37 Mon Sep 17 00:00:00 2001 From: Arnau Bennassar Date: Thu, 16 Mar 2023 10:16:23 +0100 Subject: [PATCH] Fix boot condition for GER signal being sent (#1837) * Fix boot condition for GER signal being sent * Fix boot condition for GER signal being sent * Fix boot condition for GER signal being sent --- sequencer/closingsignalsmanager.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sequencer/closingsignalsmanager.go b/sequencer/closingsignalsmanager.go index c0985cb9e0..5c465757d4 100644 --- a/sequencer/closingsignalsmanager.go +++ b/sequencer/closingsignalsmanager.go @@ -5,7 +5,6 @@ import ( "time" "github.com/0xPolygonHermez/zkevm-node/log" - "github.com/ethereum/go-ethereum/common" ) type closingSignalsManager struct { @@ -46,8 +45,13 @@ func (c *closingSignalsManager) checkSendToL1Timeout() { } func (c *closingSignalsManager) checkGERUpdate() { - var lastGERSent common.Hash - + lastBatch, err := c.dbManager.GetLastBatch(c.ctx) + for err != nil { + log.Errorf("error getting last batch: %v", err) + time.Sleep(time.Second) + lastBatch, err = c.dbManager.GetLastBatch(c.ctx) + } + lastGERSent := lastBatch.GlobalExitRoot for { time.Sleep(c.cfg.ClosingSignalsManagerWaitForCheckingGER.Duration)