diff --git a/discovery/gossiper_test.go b/discovery/gossiper_test.go index b3bccdb4..eebf1bd6 100644 --- a/discovery/gossiper_test.go +++ b/discovery/gossiper_test.go @@ -12,6 +12,7 @@ import ( "reflect" "strings" "sync" + "sync/atomic" "testing" "time" @@ -3616,6 +3617,12 @@ func TestCalculateCorrectSubBatchSizesDifferentDelay(t *testing.T) { } } +// markGraphSynced allows us to report that the initial historical sync has +// completed. +func (m *SyncManager) markGraphSyncing() { + atomic.StoreInt32(&m.initialHistoricalSyncCompleted, 0) +} + // TestBroadcastAnnsAfterGraphSynced ensures that we only broadcast // announcements after the graph has been considered as synced, i.e., after our // initial historical sync has completed. diff --git a/discovery/sync_manager.go b/discovery/sync_manager.go index fb004390..90c64314 100644 --- a/discovery/sync_manager.go +++ b/discovery/sync_manager.go @@ -316,7 +316,6 @@ func (m *SyncManager) syncerHandler() { if !attemptHistoricalSync { continue } - m.markGraphSyncing() log.Debugf("Attempting initial historical sync with "+ "GossipSyncer(%x)", s.cfg.peerPub) @@ -751,12 +750,6 @@ func (m *SyncManager) markGraphSynced() { atomic.StoreInt32(&m.initialHistoricalSyncCompleted, 1) } -// markGraphSyncing allows us to report that the initial historical sync is -// still undergoing. -func (m *SyncManager) markGraphSyncing() { - atomic.StoreInt32(&m.initialHistoricalSyncCompleted, 0) -} - // IsGraphSynced determines whether we've completed our initial historical sync. // The initial historical sync is done to ensure we've ingested as much of the // public graph as possible.