Browse Source

Manage appropriate response codes for share submission with GBT.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
cc7c274543
  1. 5
      cgminer.c
  2. 3
      util.c

5
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 pool *pool = work->pool;
struct cgpu_info *cgpu = thr_info[work->thr_id].cgpu; 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++; cgpu->accepted++;
total_accepted++; total_accepted++;
pool->accepted++; pool->accepted++;
@ -2189,6 +2189,7 @@ share_result(json_t *val, json_t *res, json_t *err, const struct work *work,
else else
strcpy(where, ""); strcpy(where, "");
if (!work->gbt)
res = json_object_get(val, "reject-reason"); res = json_object_get(val, "reject-reason");
if (res) { if (res) {
const char *reasontmp = json_string_value(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); sprintf(s, "{\"id\": 0, \"method\": \"submitblock\", \"params\": [\"%s\", {}]}", gbt_block);
} else } else
sprintf(s, "{\"method\": \"getwork\", \"params\": [ \"%s\" ], \"id\":1}", hexstr); 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"); strcat(s, "\n");
gettimeofday(&tv_submit, NULL); gettimeofday(&tv_submit, NULL);

3
util.c

@ -451,8 +451,7 @@ json_t *json_rpc_call(CURL *curl, const char *url,
res_val = json_object_get(val, "result"); res_val = json_object_get(val, "result");
err_val = json_object_get(val, "error"); err_val = json_object_get(val, "error");
if (!res_val || json_is_null(res_val) || if (!res_val ||(err_val && !json_is_null(err_val))) {
(err_val && !json_is_null(err_val))) {
char *s; char *s;
if (err_val) if (err_val)

Loading…
Cancel
Save