From e22aca94f1ea5f0a0747717c4987cbe72ac55a80 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Mon, 16 May 2016 22:08:30 +0200 Subject: [PATCH] stats: fix get_stats answer when not allowed ccminer was answering both the error and the data also remove the get_version stats hack... --- util.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/util.cpp b/util.cpp index b1b521c..555111a 100644 --- a/util.cpp +++ b/util.cpp @@ -1624,7 +1624,7 @@ static bool stratum_benchdata(json_t *result, json_t *params, int thr_id) struct cgpu_info *cgpu = &thr_info[thr_id].gpu; json_t *val; - if (!cgpu) return false; + if (!cgpu || !opt_stratum_stats) return false; #if defined(WIN32) && (defined(_M_X64) || defined(__x86_64__)) strcpy(os, "win64"); @@ -1683,7 +1683,7 @@ static bool stratum_get_stats(struct stratum_ctx *sctx, json_t *id, json_t *para ret = stratum_benchdata(val, params, 0); - if (!opt_stratum_stats || !ret) { + if (!ret) { json_object_set_error(val, 1, "disabled"); //EPERM } else { json_object_set_new(val, "error", json_null()); @@ -1708,14 +1708,7 @@ static bool stratum_get_version(struct stratum_ctx *sctx, json_t *id, json_t *pa val = json_object(); json_object_set(val, "id", id); - - if (opt_stratum_stats && params) { - // linked here as transition, miners without get_stats method could fail - ret = stratum_benchdata(val, params, 0); - if (!ret) json_object_set_error(val, 1, "disabled"); // EPERM - } else { - json_object_set_new(val, "result", json_string(USER_AGENT)); - } + json_object_set_new(val, "result", json_string(USER_AGENT)); if (ret) json_object_set_new(val, "error", json_null()); s = json_dumps(val, 0);