This repository was archived by the owner on Nov 21, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import (
2525)
2626
2727const ten = 10
28+ const batchMultiplier = 5
2829
2930// EthTxManager represents the eth tx manager interface
3031type EthTxManager interface {
@@ -176,6 +177,11 @@ func (s *SequenceSender) batchRetrieval(ctx context.Context) error {
176177 s .logger .Info ("context cancelled, stopping batch retrieval" )
177178 return ctx .Err ()
178179 default :
180+ if s .checkWait () {
181+ <- ticker .C
182+ continue
183+ }
184+
179185 // Try to retrieve batch from RPC
180186 rpcBatch , err := s .rpcClient .GetBatch (currentBatchNumber )
181187 if err != nil {
@@ -206,6 +212,17 @@ func (s *SequenceSender) batchRetrieval(ctx context.Context) error {
206212 }
207213}
208214
215+ func (s * SequenceSender ) checkWait () bool {
216+ s .mutexSequence .Lock ()
217+ defer s .mutexSequence .Unlock ()
218+
219+ if uint64 (len (s .sequenceList )) >= s .cfg .MaxBatchesForL1 * batchMultiplier {
220+ s .logger .Infof ("Sequence list is full: %d, waiting to sync batch from rpc." , len (s .sequenceList ))
221+ return true
222+ }
223+ return false
224+ }
225+
209226func (s * SequenceSender ) populateSequenceData (rpcBatch * types.RPCBatch , batchNumber uint64 ) error {
210227 s .mutexSequence .Lock ()
211228 defer s .mutexSequence .Unlock ()
You can’t perform that action at this time.
0 commit comments