From 5000535907442e2bec2fba971b80d7f734009295 Mon Sep 17 00:00:00 2001 From: Jim McDonald Date: Sat, 19 Oct 2019 21:35:45 +0100 Subject: [PATCH] Waiting condition check prior to waiting log entry (#3802) --- beacon-chain/sync/initial-sync/service.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/beacon-chain/sync/initial-sync/service.go b/beacon-chain/sync/initial-sync/service.go index bd5a7862e..247af6f20 100644 --- a/beacon-chain/sync/initial-sync/service.go +++ b/beacon-chain/sync/initial-sync/service.go @@ -92,14 +92,13 @@ func (s *InitialSync) Start() { // Every 5 sec, report handshake count. for { count := peerstatus.Count() + if count >= minStatusCount { + break + } log.WithField( "handshakes", fmt.Sprintf("%d/%d", count, minStatusCount), ).Info("Waiting for enough peer handshakes before syncing") - - if count >= minStatusCount { - break - } time.Sleep(handshakePollingInterval) }