Skip to content

Commit

Permalink
Revert "fix(p2p/peerTracker): fix bootstraping (celestiaorg#169)"
Browse files Browse the repository at this point in the history
This reverts commit dbcee58.
  • Loading branch information
vgonkivs committed Apr 2, 2024
1 parent dbcee58 commit ca440ae
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions p2p/peer_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

Expand Down

0 comments on commit ca440ae

Please sign in to comment.