Pass json error value to share result function to be able to parse reject reason in stratum.
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
diff --git a/cgminer.c b/cgminer.c
index 4969315..c752517 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -1810,8 +1810,8 @@ static void reject_pool(struct pool *pool)
* rejected values but the chance of two submits completing at the
* same time is zero so there is no point adding extra locking */
static void
-share_result(json_t *val, json_t *res, const struct work *work, char *hashshow,
- bool resubmit, char *worktime)
+share_result(json_t *val, json_t *res, json_t *err, const struct work *work,
+ char *hashshow, bool resubmit, char *worktime)
{
struct pool *pool = work->pool;
struct cgpu_info *cgpu = thr_info[work->thr_id].cgpu;
@@ -1917,7 +1917,7 @@ share_result(json_t *val, json_t *res, const struct work *work, char *hashshow,
static bool submit_upstream_work(const struct work *work, CURL *curl, bool resubmit)
{
char *hexstr = NULL;
- json_t *val, *res;
+ json_t *val, *res, *err;
char s[345], sd[345];
bool rc = false;
int thr_id = work->thr_id;
@@ -1968,6 +1968,7 @@ static bool submit_upstream_work(const struct work *work, CURL *curl, bool resub
applog(LOG_WARNING, "Pool %d communication resumed, submitting work", pool->pool_no);
res = json_object_get(val, "result");
+ err = json_object_get(val, "error");
if (!QUIET) {
hash32 = (uint32_t *)(work->hash);
@@ -2022,7 +2023,7 @@ static bool submit_upstream_work(const struct work *work, CURL *curl, bool resub
}
}
- share_result(val, res, work, hashshow, resubmit, worktime);
+ share_result(val, res, err, work, hashshow, resubmit, worktime);
cgpu->utility = cgpu->accepted / total_secs * 60;
@@ -4048,7 +4049,7 @@ out_unlock:
}
}
-static void stratum_share_result(json_t *val, json_t *res_val,
+static void stratum_share_result(json_t *val, json_t *res_val, json_t *err_val,
struct stratum_share *sshare)
{
struct work *work = &sshare->work;
@@ -4060,7 +4061,7 @@ static void stratum_share_result(json_t *val, json_t *res_val,
intdiff = round(work->work_difficulty);
sprintf(hashshow, "%08lx Diff %d%s", (unsigned long)(hash32[6]), intdiff,
work->block? " BLOCK!" : "");
- share_result(val, res_val, work, hashshow, false, "");
+ share_result(val, res_val, err_val, work, hashshow, false, "");
}
/* Parses stratum json responses and tries to find the id that the request
@@ -4112,7 +4113,7 @@ static bool parse_stratum_response(char *s)
applog(LOG_NOTICE, "Rejected untracked stratum share");
goto out;
}
- stratum_share_result(val, res_val, sshare);
+ stratum_share_result(val, res_val, err_val, sshare);
free(sshare);
ret = true;