Roll MakeConnectionToPeers into CreateSyncConfig

pull/686/head
Eugene Kim 6 years ago
parent 1aa2d9bbd6
commit 56f1c60928
  1. 6
      api/service/syncing/syncing.go
  2. 1
      node/node_syncing.go

@ -166,11 +166,7 @@ func (ss *StateSync) CreateSyncConfig(peers []p2p.Peer) error {
} }
} }
utils.GetLogInstance().Info("[SYNC] Finished creating SyncConfig") utils.GetLogInstance().Info("[SYNC] Finished creating SyncConfig")
return nil
}
// MakeConnectionToPeers makes grpc connection to all peers.
func (ss *StateSync) MakeConnectionToPeers() {
var wg sync.WaitGroup var wg sync.WaitGroup
wg.Add(ss.peerNumber) wg.Add(ss.peerNumber)
for id := range ss.syncConfig.peers { for id := range ss.syncConfig.peers {
@ -182,6 +178,8 @@ func (ss *StateSync) MakeConnectionToPeers() {
wg.Wait() wg.Wait()
ss.CleanUpNilPeers() ss.CleanUpNilPeers()
utils.GetLogInstance().Info("[SYNC] Finished making connection to peers.") utils.GetLogInstance().Info("[SYNC] Finished making connection to peers.")
return nil
} }
// GetActivePeerNumber returns the number of active peers // GetActivePeerNumber returns the number of active peers

@ -67,7 +67,6 @@ SyncingLoop:
ctxerror.Log15(utils.GetLogInstance().Debug, err) ctxerror.Log15(utils.GetLogInstance().Debug, err)
continue SyncingLoop continue SyncingLoop
} }
node.stateSync.MakeConnectionToPeers()
} }
if node.stateSync.IsOutOfSync(bc) { if node.stateSync.IsOutOfSync(bc) {
utils.GetLogInstance().Debug("[SYNC] out of sync, doing syncing") utils.GetLogInstance().Debug("[SYNC] out of sync, doing syncing")

Loading…
Cancel
Save