From b447dc560944ef78e83f7a1faab6907e8b190be6 Mon Sep 17 00:00:00 2001 From: ylsGit Date: Wed, 24 Apr 2024 10:30:39 +0800 Subject: [PATCH] fix potential null pointer (#186) --- sequencer/sequencer.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sequencer/sequencer.go b/sequencer/sequencer.go index b321ad616f..b6ce44661e 100644 --- a/sequencer/sequencer.go +++ b/sequencer/sequencer.go @@ -96,6 +96,10 @@ func (s *Sequencer) Start(ctx context.Context) { s.updateDataStreamerFile(ctx, s.cfg.StreamServer.ChainID) } + s.workerReadyTxsCond = newTimeoutCond(&sync.Mutex{}) + s.worker = NewWorker(s.stateIntf, s.batchCfg.Constraints, s.workerReadyTxsCond) + s.finalizer = newFinalizer(s.cfg.Finalizer, s.poolCfg, s.worker, s.pool, s.stateIntf, s.etherman, s.address, s.isSynced, s.batchCfg.Constraints, s.eventLog, s.streamServer, s.workerReadyTxsCond, s.dataToStream) + go s.loadFromPool(ctx) go s.countPendingTx() @@ -104,9 +108,6 @@ func (s *Sequencer) Start(ctx context.Context) { go s.sendDataToStreamer(s.cfg.StreamServer.ChainID) } - s.workerReadyTxsCond = newTimeoutCond(&sync.Mutex{}) - s.worker = NewWorker(s.stateIntf, s.batchCfg.Constraints, s.workerReadyTxsCond) - s.finalizer = newFinalizer(s.cfg.Finalizer, s.poolCfg, s.worker, s.pool, s.stateIntf, s.etherman, s.address, s.isSynced, s.batchCfg.Constraints, s.eventLog, s.streamServer, s.workerReadyTxsCond, s.dataToStream) go s.finalizer.Start(ctx) go s.deleteOldPoolTxs(ctx)