Skip to content

Commit

Permalink
Fixed milestone sync if there is no new waypoints (#12787)
Browse files Browse the repository at this point in the history
  • Loading branch information
eastorski authored Nov 19, 2024
1 parent adfcb13 commit d502471
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions polygon/sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -766,15 +766,16 @@ func (s *Sync) sync(
blockDownload blockDownloadFunc,
) (syncToTipResult, error) {
var waypoint heimdall.Waypoint
var err error

for {
newWaypoint, err := waypointSync(ctx)
waypoint, err = waypointSync(ctx)
if err != nil {
return syncToTipResult{}, err
}

// notify about latest waypoint end block so that eth_syncing API doesn't flicker on initial sync
s.notifications.NewLastBlockSeen(newWaypoint.EndBlock().Uint64())
s.notifications.NewLastBlockSeen(waypoint.EndBlock().Uint64())

newTip, err := blockDownload(ctx, tip.Number.Uint64()+1)
if err != nil {
Expand All @@ -794,7 +795,6 @@ func (s *Sync) sync(
}

tip = newTip
waypoint = newWaypoint
}

return syncToTipResult{latestTip: tip, latestWaypoint: waypoint}, nil
Expand Down

0 comments on commit d502471

Please sign in to comment.