Manage appropriate response codes for share submission with GBT.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
diff --git a/cgminer.c b/cgminer.c
index 57fff4c..eae7228 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -2131,7 +2131,7 @@ share_result(json_t *val, json_t *res, json_t *err, const struct work *work,
struct pool *pool = work->pool;
struct cgpu_info *cgpu = thr_info[work->thr_id].cgpu;
- if (json_is_true(res)) {
+ if (json_is_true(res) || (work->gbt && json_is_null(res))) {
cgpu->accepted++;
total_accepted++;
pool->accepted++;
@@ -2189,7 +2189,8 @@ share_result(json_t *val, json_t *res, json_t *err, const struct work *work,
else
strcpy(where, "");
- res = json_object_get(val, "reject-reason");
+ if (!work->gbt)
+ res = json_object_get(val, "reject-reason");
if (res) {
const char *reasontmp = json_string_value(res);
@@ -2329,7 +2330,7 @@ static bool submit_upstream_work(struct work *work, CURL *curl, bool resubmit)
sprintf(s, "{\"id\": 0, \"method\": \"submitblock\", \"params\": [\"%s\", {}]}", gbt_block);
} else
sprintf(s, "{\"method\": \"getwork\", \"params\": [ \"%s\" ], \"id\":1}", hexstr);
- applog(LOG_WARNING, "DBG: sending %s submit RPC call: %s", pool->rpc_url, s);
+ applog(LOG_DEBUG, "DBG: sending %s submit RPC call: %s", pool->rpc_url, s);
strcat(s, "\n");
gettimeofday(&tv_submit, NULL);
diff --git a/util.c b/util.c
index 439c603..072c5ce 100644
--- a/util.c
+++ b/util.c
@@ -451,8 +451,7 @@ json_t *json_rpc_call(CURL *curl, const char *url,
res_val = json_object_get(val, "result");
err_val = json_object_get(val, "error");
- if (!res_val || json_is_null(res_val) ||
- (err_val && !json_is_null(err_val))) {
+ if (!res_val ||(err_val && !json_is_null(err_val))) {
char *s;
if (err_val)