From ba9678bd610ade808547497e3efff6ce7487370c Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Tue, 8 Sep 2020 12:11:30 +0200 Subject: [PATCH] Use for to iterate over channel Signed-off-by: Jakub Sztandera --- chain/blocksync/peer_tracker.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/chain/blocksync/peer_tracker.go b/chain/blocksync/peer_tracker.go index 3a9d9089b..7c30b92a2 100644 --- a/chain/blocksync/peer_tracker.go +++ b/chain/blocksync/peer_tracker.go @@ -42,12 +42,9 @@ func newPeerTracker(lc fx.Lifecycle, h host.Host, pmgr *peermgr.PeerMgr) *bsPeer if err != nil { panic(err) } + go func() { - var newPeer interface{} - ok := true - for ok { - newPeer, ok = <-sub.Out() - log.Warnf("new peer from hello in tracker: %s", newPeer.(peermgr.NewFilPeer).Id) + for newPeer := range sub.Out() { bsPt.addPeer(newPeer.(peermgr.NewFilPeer).Id) } }()