Skip to content

Commit

Permalink
this allow to reach the synced state sooner (#706)
Browse files Browse the repository at this point in the history
  • Loading branch information
ARR552 authored Jun 7, 2022
1 parent 35a910d commit 03f7f72
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion synchronizer/synchronizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ func NewSynchronizer(
}, nil
}

var waitDuration = time.Duration(0)

// Sync function will read the last state synced and will continue from that point.
// Sync() will read blockchain events to detect rollup updates
func (s *ClientSynchronizer) Sync() error {
Expand Down Expand Up @@ -87,7 +89,6 @@ func (s *ClientSynchronizer) Sync() error {
if err != nil {
log.Fatal("error setting initial batch number. Error: ", err)
}
waitDuration := time.Duration(0)
for {
select {
case <-s.ctx.Done():
Expand Down Expand Up @@ -190,6 +191,7 @@ func (s *ClientSynchronizer) syncBlocks(lastEthBlockSynced *state.Block) (*state
fromBlock = toBlock + 1

if lastKnownBlock.Cmp(new(big.Int).SetUint64(fromBlock)) < 1 {
waitDuration = s.cfg.SyncInterval.Duration
break
}
}
Expand Down

0 comments on commit 03f7f72

Please sign in to comment.