Skip to content

Commit

Permalink
synced log
Browse files Browse the repository at this point in the history
  • Loading branch information
ARR552 committed Aug 18, 2023
1 parent 31875a6 commit 0a7ba19
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions synchronizer/synchronizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ func (s *ClientSynchronizer) Sync() error {
continue
}
lastKnownBlock := header.Number.Uint64()
if lastBlockSynced.BlockNumber == lastKnownBlock {
if lastBlockSynced.BlockNumber == lastKnownBlock && !s.synced {
log.Infof("NetworkID %d Synced!", s.networkID)
waitDuration = s.cfg.SyncInterval.Duration
s.synced = true
s.chSynced <- s.networkID
Expand Down Expand Up @@ -258,9 +259,12 @@ func (s *ClientSynchronizer) syncBlocks(lastBlockSynced *etherman.Block) (*ether
fromBlock = toBlock + 1

if lastKnownBlock.Cmp(new(big.Int).SetUint64(toBlock)) < 1 {
waitDuration = s.cfg.SyncInterval.Duration
s.synced = true
s.chSynced <- s.networkID
if !s.synced {
log.Infof("NetworkID %d Synced!", s.networkID)
waitDuration = s.cfg.SyncInterval.Duration
s.synced = true
s.chSynced <- s.networkID
}
break
}
if len(blocks) == 0 { // If there is no events in the checked blocks range and lastKnownBlock > fromBlock.
Expand Down

0 comments on commit 0a7ba19

Please sign in to comment.