From 5f444ce000d4217ce389239d8bdb47f2079c39c1 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 19 Jun 2014 09:44:12 -0500 Subject: [PATCH] Wait for conection to peer before mining with CPU. --- cpuminer.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cpuminer.go b/cpuminer.go index d0ea2485..44da64c6 100644 --- a/cpuminer.go +++ b/cpuminer.go @@ -270,6 +270,14 @@ out: // Non-blocking select to fall through } + // Wait until there is a connection to at least one other peer + // since there is no way to relay a found block or receive + // transactions to work on when there are no connected peers. + if m.server.ConnectedCount() == 0 { + time.Sleep(time.Second) + continue + } + // No point in searching for a solution before the chain is // synced. Also, grab the same lock as used for block // submission, since the current block will be changing and