From 0914d4e0d2b29249bdec9d2342256c39e1787bf3 Mon Sep 17 00:00:00 2001 From: Evgeny Danilenko <6655321@bk.ru> Date: Thu, 9 Nov 2017 12:34:35 +0300 Subject: [PATCH] les: fix misuse of WaitGroup (#15365) --- les/fetcher.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/les/fetcher.go b/les/fetcher.go index 4fc142f0f..3fc4df30b 100644 --- a/les/fetcher.go +++ b/les/fetcher.go @@ -117,16 +117,16 @@ func newLightFetcher(pm *ProtocolManager) *lightFetcher { maxConfirmedTd: big.NewInt(0), } pm.peers.notify(f) + + f.pm.wg.Add(1) go f.syncLoop() return f } // syncLoop is the main event loop of the light fetcher func (f *lightFetcher) syncLoop() { - f.pm.wg.Add(1) - defer f.pm.wg.Done() - requesting := false + defer f.pm.wg.Done() for { select { case <-f.pm.quitSync: