mirror of
https://github.com/GOSTSec/ccminer
synced 2025-08-26 13:51:51 +00:00
api: add stales and pools algo/name
+ remove hardcoded stales check on suprnova...
This commit is contained in:
parent
e1fd687b9b
commit
35738cec23
25
api.cpp
25
api.cpp
@ -8,7 +8,7 @@
|
|||||||
* Software Foundation; either version 2 of the License, or (at your option)
|
* Software Foundation; either version 2 of the License, or (at your option)
|
||||||
* any later version. See COPYING for more details.
|
* any later version. See COPYING for more details.
|
||||||
*/
|
*/
|
||||||
#define APIVERSION "1.7"
|
#define APIVERSION "1.8"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
# define _WINSOCK_DEPRECATED_NO_WARNINGS
|
# define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||||
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include "miner.h"
|
#include "miner.h"
|
||||||
#include "nvml.h"
|
#include "nvml.h"
|
||||||
|
#include "algos.h"
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
@ -165,7 +166,7 @@ static char *getthreads(char *params)
|
|||||||
*/
|
*/
|
||||||
static char *getsummary(char *params)
|
static char *getsummary(char *params)
|
||||||
{
|
{
|
||||||
char algo[64]; *algo = '\0';
|
char algo[64] = { 0 };
|
||||||
time_t ts = time(NULL);
|
time_t ts = time(NULL);
|
||||||
double accps, uptime = difftime(ts, startup);
|
double accps, uptime = difftime(ts, startup);
|
||||||
uint32_t wait_time = 0, solved_count = 0;
|
uint32_t wait_time = 0, solved_count = 0;
|
||||||
@ -200,7 +201,7 @@ static char *getpoolnfo(char *params)
|
|||||||
{
|
{
|
||||||
char *s = buffer;
|
char *s = buffer;
|
||||||
char jobid[128] = { 0 };
|
char jobid[128] = { 0 };
|
||||||
char nonce[128] = { 0 };
|
char extra[96] = { 0 };
|
||||||
int pooln = params ? atoi(params) % num_pools : cur_pooln;
|
int pooln = params ? atoi(params) % num_pools : cur_pooln;
|
||||||
struct pool_infos *p = &pools[pooln];
|
struct pool_infos *p = &pools[pooln];
|
||||||
uint32_t last_share = 0;
|
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));
|
strncpy(jobid, stratum.job.job_id, sizeof(stratum.job.job_id));
|
||||||
if (stratum.job.xnonce2) {
|
if (stratum.job.xnonce2) {
|
||||||
/* used temporary to be sure all is ok */
|
/* used temporary to be sure all is ok */
|
||||||
sprintf(nonce, "0x");
|
sprintf(extra, "0x");
|
||||||
cbin2hex(&nonce[2], (const char*) stratum.job.xnonce2, stratum.xnonce2_size);
|
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|",
|
"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->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,
|
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);
|
p->disconnects, p->wait_time, p->work_time, last_share);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
@ -28,7 +28,7 @@ function ignoreField($key)
|
|||||||
{
|
{
|
||||||
$ignored = array(
|
$ignored = array(
|
||||||
'API','VER','GPU','BUS','POOLS',
|
'API','VER','GPU','BUS','POOLS',
|
||||||
'CARD','GPUS','CPU','TS',
|
'CARD','GPUS','CPU','TS','URL',
|
||||||
);
|
);
|
||||||
return in_array($key, $ignored);
|
return in_array($key, $ignored);
|
||||||
}
|
}
|
||||||
@ -48,6 +48,7 @@ function translateField($key)
|
|||||||
$intl['REJ'] = 'Rejected';
|
$intl['REJ'] = 'Rejected';
|
||||||
$intl['SOLV'] = 'Solved';
|
$intl['SOLV'] = 'Solved';
|
||||||
$intl['BEST'] = 'Best share';
|
$intl['BEST'] = 'Best share';
|
||||||
|
$intl['STALE'] = 'Stale shares';
|
||||||
$intl['LAST'] = 'Last share';
|
$intl['LAST'] = 'Last share';
|
||||||
$intl['DIFF'] = 'Difficulty';
|
$intl['DIFF'] = 'Difficulty';
|
||||||
$intl['NETKHS'] = 'Net Rate';
|
$intl['NETKHS'] = 'Net Rate';
|
||||||
@ -59,6 +60,7 @@ function translateField($key)
|
|||||||
$intl['H'] = 'Bloc height';
|
$intl['H'] = 'Bloc height';
|
||||||
$intl['I'] = 'Intensity';
|
$intl['I'] = 'Intensity';
|
||||||
$intl['HWF'] = 'Failures';
|
$intl['HWF'] = 'Failures';
|
||||||
|
$intl['POOL'] = 'Pool';
|
||||||
$intl['POOLS'] = 'Pools';
|
$intl['POOLS'] = 'Pools';
|
||||||
|
|
||||||
$intl['TEMP'] = 'T°c';
|
$intl['TEMP'] = 'T°c';
|
||||||
|
@ -728,12 +728,6 @@ static int share_result(int result, int pooln, double sharediff, const char *rea
|
|||||||
p->accepted_count + p->rejected_count,
|
p->accepted_count + p->rejected_count,
|
||||||
suppl, s, flag);
|
suppl, s, flag);
|
||||||
if (reason) {
|
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);
|
applog(LOG_WARNING, "reject reason: %s", reason);
|
||||||
if (!check_dups && strncasecmp(reason, "duplicate", 9) == 0) {
|
if (!check_dups && strncasecmp(reason, "duplicate", 9) == 0) {
|
||||||
applog(LOG_WARNING, "enabling duplicates check feature");
|
applog(LOG_WARNING, "enabling duplicates check feature");
|
||||||
@ -761,7 +755,7 @@ static bool submit_upstream_work(CURL *curl, struct work *work)
|
|||||||
pool->stales_count++;
|
pool->stales_count++;
|
||||||
if (opt_debug) applog(LOG_DEBUG, "outdated job %s, new %s stales=%d",
|
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);
|
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");
|
if (!opt_quiet) applog(LOG_WARNING, "Enabled stratum stale jobs workaround");
|
||||||
check_stratum_jobs = true;
|
check_stratum_jobs = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user