Skip to content

Commit 01b277e

Browse files
committed
resolve potential rare but possible case that will annoy the user
1 parent a99d7ac commit 01b277e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

sync/sync_head.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ func (s *Syncer[H]) Head(ctx context.Context, _ ...header.HeadOption[H]) (H, err
2727
}
2828
// if subjective header is recent enough (relative to the network's block time) - just use it
2929
if isRecent(sbjHead, s.Params.blockTime, s.Params.recencyThreshold) {
30+
31+
// TODO(@Wondertan): This is temporary. Subjective tail is always triggered when Syncer is started
32+
// unless we have a very recent head. Generally this is fine and the way it should work, however due to
33+
// the way diff syncing works in moveTail method, we need to ensure that diff syncing happens on Start always
34+
// which is triggered by this call.
35+
// To be removed by bsync.
36+
_, err = s.subjectiveTail(ctx, sbjHead)
37+
if err != nil {
38+
log.Errorw("getting subjective tail", "err", err)
39+
return sbjHead, err
40+
}
41+
3042
return sbjHead, nil
3143
}
3244

sync/sync_tail.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212

1313
// TODO:
1414
// * Refactor tests
15-
// * Ensure sync always happen on start
1615

1716
// subjectiveTail returns the current Tail header.
1817
// Lazily fetching it if it doesn't exist locally or moving it to a different height.

0 commit comments

Comments
 (0)