Commit cc67d34e authored by Adrian Sutton's avatar Adrian Sutton Committed by GitHub

op-proposer, op-batcher: Wait for sync in Start rather than loop. (#11192)

Ensures that if it fails, the process exits with an error, rather than just exiting the runloop and continuing on in a zombie mode that doesn't do anything but doesn't exit.
parent 96b9e701
......@@ -114,6 +114,13 @@ func (l *BatchSubmitter) StartBatchSubmitting() error {
l.clearState(l.shutdownCtx)
l.lastStoredBlock = eth.BlockID{}
if l.Config.WaitNodeSync {
err := l.waitNodeSync()
if err != nil {
return fmt.Errorf("error waiting for node sync: %w", err)
}
}
l.wg.Add(1)
go l.loop()
......@@ -289,13 +296,6 @@ const (
func (l *BatchSubmitter) loop() {
defer l.wg.Done()
if l.Config.WaitNodeSync {
err := l.waitNodeSync()
if err != nil {
l.Log.Error("Error waiting for node sync", "err", err)
return
}
}
receiptsCh := make(chan txmgr.TxReceipt[txRef])
queue := txmgr.NewQueue[txRef](l.killCtx, l.Txmgr, l.Config.MaxPendingTransactions)
......
......@@ -178,6 +178,13 @@ func (l *L2OutputSubmitter) StartL2OutputSubmitting() error {
}
l.running = true
if l.Cfg.WaitNodeSync {
err := l.waitNodeSync()
if err != nil {
return fmt.Errorf("error waiting for node sync: %w", err)
}
}
l.wg.Add(1)
go l.loop()
......@@ -429,14 +436,6 @@ func (l *L2OutputSubmitter) loop() {
defer l.wg.Done()
ctx := l.ctx
if l.Cfg.WaitNodeSync {
err := l.waitNodeSync()
if err != nil {
l.Log.Error("Error waiting for node sync", "err", err)
return
}
}
if l.dgfContract == nil {
l.loopL2OO(ctx)
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment