From a988337f52f6bb84a8839a309d7f27ebba59cb97 Mon Sep 17 00:00:00 2001 From: pooler Date: Thu, 22 May 2014 12:10:08 +0200 Subject: [PATCH] Switch to getwork if no payout address is provided --- cpu-miner.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cpu-miner.c b/cpu-miner.c index 1823571..45a6424 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -448,7 +448,11 @@ static bool gbt_work_decode(const json_t *val, struct work *work) } else { int64_t cbvalue; if (!pk_script_size) { - applog(LOG_ERR, "No payout address provided"); + if (allow_getwork) { + applog(LOG_INFO, "No payout address provided, switching to getwork"); + have_gbt = false; + } else + applog(LOG_ERR, "No payout address provided"); goto out; } tmp = json_object_get(val, "coinbasevalue"); @@ -796,9 +800,13 @@ start: if (!val) return false; - if (have_gbt) + if (have_gbt) { rc = gbt_work_decode(json_object_get(val, "result"), work); - else + if (!have_gbt) { + json_decref(val); + goto start; + } + } else rc = work_decode(json_object_get(val, "result"), work); if (opt_debug && rc) {