From d0a018a287526888b14d777c28fdb32041833c6a Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sun, 2 Nov 2014 06:07:23 +0100 Subject: [PATCH] Fix for non-rpc2 solo mining and update http headers --- NEWS | 1 + cpu-miner.c | 12 ++++++++---- util.c | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 2c3721940..3a506b925 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ Version 1.0.7 (Tanguy Pruvot) - Add NIST5 and QUBIT algos - Show current stratum bloc height +- Fix wallet solo mining Version 1.0.6 (Tanguy Pruvot) - Fix scrypt algo diff --git a/cpu-miner.c b/cpu-miner.c index 410023bab..bbc3b8698 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -692,6 +692,10 @@ static bool gbt_work_decode(const json_t *val, struct work *work) if (version > 2) { if (version_reduce) { version = 2; + } else if (have_gbt && allow_getwork && !version_force && version == 1024) { + applog(LOG_DEBUG, "Switching to getwork"); + have_gbt = false; + goto out; } else if (!version_force) { applog(LOG_ERR, "Unrecognized block version: %u", version); goto out; @@ -1222,10 +1226,10 @@ static bool get_upstream_work(CURL *curl, struct work *work) } else rc = work_decode(json_object_get(val, "result"), work); - if (opt_debug && rc) { + if (opt_protocol && rc) { timeval_subtract(&diff, &tv_end, &tv_start); - applog(LOG_DEBUG, "DEBUG: got new work in %d ms", - diff.tv_sec * 1000 + diff.tv_usec / 1000); + applog(LOG_DEBUG, "got new work in %.2f ms", + (1000.0 * diff.tv_sec) + (0.001 * diff.tv_usec)); } json_decref(val); @@ -1386,7 +1390,7 @@ static void *workio_thread(void *userdata) return NULL; } - if(!have_stratum) { + if(jsonrpc_2 && !have_stratum) { ok = workio_login(curl); } diff --git a/util.c b/util.c index 6e3a5db79..cd109ca2a 100644 --- a/util.c +++ b/util.c @@ -442,7 +442,7 @@ json_t *json_rpc_call(CURL *curl, const char *url, headers = curl_slist_append(headers, "Content-Type: application/json"); headers = curl_slist_append(headers, len_hdr); headers = curl_slist_append(headers, "User-Agent: " USER_AGENT); - headers = curl_slist_append(headers, "X-Mining-Extensions: midstate"); + headers = curl_slist_append(headers, "X-Mining-Extensions: longpoll reject-reason"); //headers = curl_slist_append(headers, "Accept:"); /* disable Accept hdr*/ //headers = curl_slist_append(headers, "Expect:"); /* disable Expect hdr*/