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.
This commit is contained in:
Conner Fromknecht 2021-01-29 00:08:44 -08:00
parent e42301dee2
commit b1fee734ec
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7
2 changed files with 7 additions and 7 deletions

@ -12,6 +12,7 @@ import (
"reflect" "reflect"
"strings" "strings"
"sync" "sync"
"sync/atomic"
"testing" "testing"
"time" "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 // TestBroadcastAnnsAfterGraphSynced ensures that we only broadcast
// announcements after the graph has been considered as synced, i.e., after our // announcements after the graph has been considered as synced, i.e., after our
// initial historical sync has completed. // initial historical sync has completed.

@ -316,7 +316,6 @@ func (m *SyncManager) syncerHandler() {
if !attemptHistoricalSync { if !attemptHistoricalSync {
continue continue
} }
m.markGraphSyncing()
log.Debugf("Attempting initial historical sync with "+ log.Debugf("Attempting initial historical sync with "+
"GossipSyncer(%x)", s.cfg.peerPub) "GossipSyncer(%x)", s.cfg.peerPub)
@ -751,12 +750,6 @@ func (m *SyncManager) markGraphSynced() {
atomic.StoreInt32(&m.initialHistoricalSyncCompleted, 1) 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. // 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 // The initial historical sync is done to ensure we've ingested as much of the
// public graph as possible. // public graph as possible.