From ca440ae5942a869b650ea661b3ca89a9acc6f6ae Mon Sep 17 00:00:00 2001 From: Viacheslav Gonkivskyi Date: Tue, 2 Apr 2024 17:55:25 +0300 Subject: [PATCH] Revert "fix(p2p/peerTracker): fix bootstraping (#169)" This reverts commit dbcee585754b820bd760ab02938f9ffb02380f1c. --- p2p/peer_tracker.go | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/p2p/peer_tracker.go b/p2p/peer_tracker.go index 04b5eaed..ecbbb626 100644 --- a/p2p/peer_tracker.go +++ b/p2p/peer_tracker.go @@ -82,14 +82,8 @@ func (p *peerTracker) bootstrap(ctx context.Context, trusted []libpeer.ID) error connectCtx, cancel := context.WithTimeout(context.Background(), time.Second*60) defer cancel() - wg := sync.WaitGroup{} - wg.Add(len(trusted)) for _, trust := range trusted { - trust := trust - go func() { - defer wg.Done() - p.connectToPeer(connectCtx, trust) - }() + go p.connectToPeer(connectCtx, trust) } // short-circuit if pidstore was not provided @@ -102,15 +96,9 @@ func (p *peerTracker) bootstrap(ctx context.Context, trusted []libpeer.ID) error return err } - wg.Add(len(prevSeen)) for _, peer := range prevSeen { - peer := peer - go func() { - defer wg.Done() - p.connectToPeer(connectCtx, peer) - }() + go p.connectToPeer(connectCtx, peer) } - wg.Wait() return nil }