diff --git a/api.cpp b/api.cpp index 337a518..cc0e0d9 100644 --- a/api.cpp +++ b/api.cpp @@ -8,7 +8,7 @@ * Software Foundation; either version 2 of the License, or (at your option) * any later version. See COPYING for more details. */ -#define APIVERSION "1.7" +#define APIVERSION "1.8" #ifdef WIN32 # define _WINSOCK_DEPRECATED_NO_WARNINGS @@ -33,6 +33,7 @@ #include "miner.h" #include "nvml.h" +#include "algos.h" #ifndef WIN32 # include @@ -165,7 +166,7 @@ static char *getthreads(char *params) */ static char *getsummary(char *params) { - char algo[64]; *algo = '\0'; + char algo[64] = { 0 }; time_t ts = time(NULL); double accps, uptime = difftime(ts, startup); uint32_t wait_time = 0, solved_count = 0; @@ -200,7 +201,7 @@ static char *getpoolnfo(char *params) { char *s = buffer; char jobid[128] = { 0 }; - char nonce[128] = { 0 }; + char extra[96] = { 0 }; int pooln = params ? atoi(params) % num_pools : cur_pooln; struct pool_infos *p = &pools[pooln]; uint32_t last_share = 0; @@ -213,16 +214,24 @@ static char *getpoolnfo(char *params) strncpy(jobid, stratum.job.job_id, sizeof(stratum.job.job_id)); if (stratum.job.xnonce2) { /* used temporary to be sure all is ok */ - sprintf(nonce, "0x"); - cbin2hex(&nonce[2], (const char*) stratum.job.xnonce2, stratum.xnonce2_size); + sprintf(extra, "0x"); + if (p->algo == ALGO_DECRED) { + char compat[32] = { 0 }; + cbin2hex(&extra[2], (const char*) stratum.xnonce1, min(36, stratum.xnonce2_size)); + cbin2hex(compat, (const char*) stratum.job.xnonce2, 4); + memcpy(&extra[2], compat, 8); // compat extranonce + } else { + cbin2hex(&extra[2], (const char*) stratum.job.xnonce2, stratum.xnonce2_size); + } } - snprintf(s, MYBUFSIZ, "URL=%s;USER=%s;SOLV=%d;ACC=%d;REJ=%d;H=%u;JOB=%s;DIFF=%.6f;" + snprintf(s, MYBUFSIZ, "POOL=%s;ALGO=%s;URL=%s;USER=%s;SOLV=%d;ACC=%d;REJ=%d;STALE=%u;H=%u;JOB=%s;DIFF=%.6f;" "BEST=%.6f;N2SZ=%d;N2=%s;PING=%u;DISCO=%u;WAIT=%u;UPTIME=%u;LAST=%u|", + strlen(p->name) ? p->name : p->short_url, algo_names[p->algo], p->url, p->type & POOL_STRATUM ? p->user : "", - p->solved_count, p->accepted_count, p->rejected_count, + p->solved_count, p->accepted_count, p->rejected_count, p->stales_count, stratum.job.height, jobid, stratum_diff, p->best_share, - (int) stratum.xnonce2_size, nonce, stratum.answer_msec, + (int) stratum.xnonce2_size, extra, stratum.answer_msec, p->disconnects, p->wait_time, p->work_time, last_share); return s; diff --git a/api/index.php b/api/index.php index 63f37c1..0d31362 100644 --- a/api/index.php +++ b/api/index.php @@ -28,7 +28,7 @@ function ignoreField($key) { $ignored = array( 'API','VER','GPU','BUS','POOLS', - 'CARD','GPUS','CPU','TS', + 'CARD','GPUS','CPU','TS','URL', ); return in_array($key, $ignored); } @@ -48,6 +48,7 @@ function translateField($key) $intl['REJ'] = 'Rejected'; $intl['SOLV'] = 'Solved'; $intl['BEST'] = 'Best share'; + $intl['STALE'] = 'Stale shares'; $intl['LAST'] = 'Last share'; $intl['DIFF'] = 'Difficulty'; $intl['NETKHS'] = 'Net Rate'; @@ -59,6 +60,7 @@ function translateField($key) $intl['H'] = 'Bloc height'; $intl['I'] = 'Intensity'; $intl['HWF'] = 'Failures'; + $intl['POOL'] = 'Pool'; $intl['POOLS'] = 'Pools'; $intl['TEMP'] = 'T°c'; diff --git a/ccminer.cpp b/ccminer.cpp index 946d5a1..48aef1f 100644 --- a/ccminer.cpp +++ b/ccminer.cpp @@ -728,12 +728,6 @@ static int share_result(int result, int pooln, double sharediff, const char *rea p->accepted_count + p->rejected_count, suppl, s, flag); if (reason) { - if (strncasecmp(reason, "Invalid job id", 14) == 0) { - applog(LOG_WARNING, "reject reason: %s", reason); - if (!opt_quiet) applog(LOG_WARNING, "stratum jobs check enabled"); - check_stratum_jobs = true; - return 1; - } applog(LOG_WARNING, "reject reason: %s", reason); if (!check_dups && strncasecmp(reason, "duplicate", 9) == 0) { applog(LOG_WARNING, "enabling duplicates check feature"); @@ -761,7 +755,7 @@ static bool submit_upstream_work(CURL *curl, struct work *work) pool->stales_count++; if (opt_debug) applog(LOG_DEBUG, "outdated job %s, new %s stales=%d", work->job_id + 8 , g_work.job_id + 8, pool->stales_count); - if (!check_stratum_jobs && strstr(pool->url, "suprnova")) { + if (!check_stratum_jobs && pool->stales_count > 5) { if (!opt_quiet) applog(LOG_WARNING, "Enabled stratum stale jobs workaround"); check_stratum_jobs = true; }