Skip to content

Commit

Permalink
Job id bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasjones committed May 24, 2014
1 parent 7f95c84 commit a23fcb4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cpu-miner.c
Original file line number Diff line number Diff line change
Expand Up @@ -1358,14 +1358,16 @@ static bool stratum_handle_response(char *buf) {
json_t *status = json_object_get(res_val, "status");
if(status) {
const char *s = json_string_value(status);
valid = !strcmp(s, "OK");
valid = !strcmp(s, "OK") && json_is_null(err_val);
} else {
valid = json_is_null(err_val);
}
} else {
valid = json_is_true(res_val);
}

share_result(valid, NULL,
err_val ? json_string_value(json_array_get(err_val, 1)) : NULL );
err_val ? (jsonrpc_2 ? json_string_value(err_val) : json_string_value(json_array_get(err_val, 1))) : NULL );

ret = true;
out: if (val)
Expand Down Expand Up @@ -1412,6 +1414,8 @@ static void *stratum_thread(void *userdata) {
|| strcmp(stratum.work.job_id, g_work.job_id))) {
pthread_mutex_lock(&g_work_lock);
memcpy(&g_work, &stratum.work, sizeof(struct work));
if(g_work.job_id) free(g_work.job_id);
g_work.job_id = strdup(stratum.work.job_id);
time(&g_work_time);
pthread_mutex_unlock(&g_work_lock);
applog(LOG_INFO, "Stratum detected new block");
Expand Down

0 comments on commit a23fcb4

Please sign in to comment.