diff --git a/beacon-chain/sync/initial-sync/service.go b/beacon-chain/sync/initial-sync/service.go index d0a51f129..2e3b40da1 100644 --- a/beacon-chain/sync/initial-sync/service.go +++ b/beacon-chain/sync/initial-sync/service.go @@ -127,7 +127,7 @@ func (s *Service) Stop() error { // Status of initial sync. func (s *Service) Status() error { - if s.Syncing() { + if s.synced.IsNotSet() && s.chainStarted.IsSet() { return errors.New("syncing") } return nil diff --git a/beacon-chain/sync/initial-sync/service_test.go b/beacon-chain/sync/initial-sync/service_test.go index 06ba18ba7..76e113606 100644 --- a/beacon-chain/sync/initial-sync/service_test.go +++ b/beacon-chain/sync/initial-sync/service_test.go @@ -327,9 +327,8 @@ func TestService_markSynced(t *testing.T) { assert.Equal(t, false, s.chainStarted.IsSet()) assert.Equal(t, false, s.synced.IsSet()) assert.Equal(t, true, s.Syncing()) - assert.ErrorContains(t, "syncing", s.Status()) + assert.NoError(t, s.Status()) s.chainStarted.Set() - assert.Equal(t, true, s.Syncing()) assert.ErrorContains(t, "syncing", s.Status()) expectedGenesisTime := time.Unix(358544700, 0) @@ -360,7 +359,6 @@ func TestService_markSynced(t *testing.T) { } assert.Equal(t, expectedGenesisTime, receivedGenesisTime) assert.Equal(t, false, s.Syncing()) - assert.NoError(t, s.Status()) } func TestService_Resync(t *testing.T) {