|
|
@ -159,17 +159,13 @@ func (ss *StateSync) CreateSyncConfig(peers []p2p.Peer) error { |
|
|
|
ss.syncConfig = &SyncConfig{ |
|
|
|
ss.syncConfig = &SyncConfig{ |
|
|
|
peers: make([]*SyncPeerConfig, ss.peerNumber), |
|
|
|
peers: make([]*SyncPeerConfig, ss.peerNumber), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var wg sync.WaitGroup |
|
|
|
|
|
|
|
wg.Add(ss.peerNumber) |
|
|
|
for id := range ss.syncConfig.peers { |
|
|
|
for id := range ss.syncConfig.peers { |
|
|
|
ss.syncConfig.peers[id] = &SyncPeerConfig{ |
|
|
|
ss.syncConfig.peers[id] = &SyncPeerConfig{ |
|
|
|
ip: peers[id].IP, |
|
|
|
ip: peers[id].IP, |
|
|
|
port: peers[id].Port, |
|
|
|
port: peers[id].Port, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
utils.GetLogInstance().Info("[SYNC] Finished creating SyncConfig") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var wg sync.WaitGroup |
|
|
|
|
|
|
|
wg.Add(ss.peerNumber) |
|
|
|
|
|
|
|
for id := range ss.syncConfig.peers { |
|
|
|
|
|
|
|
go func(peerConfig *SyncPeerConfig) { |
|
|
|
go func(peerConfig *SyncPeerConfig) { |
|
|
|
defer wg.Done() |
|
|
|
defer wg.Done() |
|
|
|
peerConfig.client = downloader.ClientSetup(peerConfig.ip, peerConfig.port) |
|
|
|
peerConfig.client = downloader.ClientSetup(peerConfig.ip, peerConfig.port) |
|
|
|