diff --git a/sync/sync_head.go b/sync/sync_head.go index c8776552..19a2b272 100644 --- a/sync/sync_head.go +++ b/sync/sync_head.go @@ -198,7 +198,7 @@ func (s *Syncer[H]) verify(ctx context.Context, newHead H) (bool, error) { // isExpired checks if header is expired against trusting period. func isExpired[H header.Header[H]](header H, period time.Duration) bool { expirationTime := header.Time().Add(period) - return !expirationTime.After(time.Now()) + return expirationTime.Before(time.Now()) } // isRecent checks if header is recent against the given recency threshold. diff --git a/sync/sync_test.go b/sync/sync_test.go index 17b5a36e..b9acb2d3 100644 --- a/sync/sync_test.go +++ b/sync/sync_test.go @@ -43,7 +43,7 @@ func TestSyncSimpleRequestingHead(t *testing.T) { err = syncer.Start(ctx) require.NoError(t, err) - time.Sleep(time.Millisecond * 10) // needs some to realize it is syncing + time.Sleep(time.Millisecond * 100) // needs some to realize it is syncing err = syncer.SyncWait(ctx) require.NoError(t, err)