Skip to content

Commit 0a52c6e

Browse files
authored
refactor(sync): simplify isExpired (#206)
1 parent 41d0d7c commit 0a52c6e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

sync/sync_head.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ func (s *Syncer[H]) verify(ctx context.Context, newHead H) (bool, error) {
198198
// isExpired checks if header is expired against trusting period.
199199
func isExpired[H header.Header[H]](header H, period time.Duration) bool {
200200
expirationTime := header.Time().Add(period)
201-
return !expirationTime.After(time.Now())
201+
return expirationTime.Before(time.Now())
202202
}
203203

204204
// isRecent checks if header is recent against the given recency threshold.

sync/sync_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func TestSyncSimpleRequestingHead(t *testing.T) {
4343
err = syncer.Start(ctx)
4444
require.NoError(t, err)
4545

46-
time.Sleep(time.Millisecond * 10) // needs some to realize it is syncing
46+
time.Sleep(time.Millisecond * 100) // needs some to realize it is syncing
4747
err = syncer.SyncWait(ctx)
4848
require.NoError(t, err)
4949

0 commit comments

Comments
 (0)