From b1fee734ecdcfbdcc62f5069c78e115726f4c118 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Fri, 29 Jan 2021 00:08:44 -0800 Subject: [PATCH] discovery/sync_manager: remove unneeded markGraphSyncing AFAICT it's not possible to flip back from bein synced_to_chain, so we remove the underlying call that could reflect this. The method is moved into the test file since it's still used to test correctness of other portions of the flow. --- discovery/gossiper_test.go | 7 +++++++ discovery/sync_manager.go | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) 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.