Skip to content

Commit

Permalink
Fix for non-rpc2 solo mining
Browse files Browse the repository at this point in the history
and update http headers
  • Loading branch information
tpruvot committed Nov 2, 2014
1 parent 7e4b0ea commit d0a018a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 8 additions & 4 deletions cpu-miner.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -1386,7 +1390,7 @@ static void *workio_thread(void *userdata)
return NULL;
}

if(!have_stratum) {
if(jsonrpc_2 && !have_stratum) {
ok = workio_login(curl);
}

Expand Down
2 changes: 1 addition & 1 deletion util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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*/

Expand Down

0 comments on commit d0a018a

Please sign in to comment.