Skip to content

Commit 630ffa3

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

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

sync/sync_head.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ 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+
// TODO(@Wondertan): This is temporary. Subjective tail is always triggered when Syncer is started
31+
// unless we have a very recent head. Generally this is fine and the way it should work, however due to
32+
// the way diff syncing works in moveTail method, we need to ensure that diff syncing happens on Start always
33+
// which is triggered by this call.
34+
// To be removed by bsync.
35+
_, err = s.subjectiveTail(ctx, sbjHead)
36+
if err != nil {
37+
log.Errorw("getting subjective tail", "err", err)
38+
return sbjHead, err
39+
}
40+
3041
return sbjHead, nil
3142
}
3243

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)