Browse Source

solo: stop submit of solved blocs (stale work)

rejects in solo mode often means "generated block is stale" (see Debug.log)

Most of current wallets only reports "rejected" reason without explanations.

So prevent this common error,
you can turn off this gbt feature (height check) with --no-gbt option.
2upstream
Tanguy Pruvot 10 years ago
parent
commit
7a0f7ab276
  1. 3
      README.txt
  2. 27
      ccminer.cpp

3
README.txt

@ -105,6 +105,8 @@ its command line interface and options. @@ -105,6 +105,8 @@ its command line interface and options.
-T, --timeout=N network timeout, in seconds (default: 270)
-s, --scantime=N upper bound on time spent scanning current work when
long polling is unavailable, in seconds (default: 5)
-N, --statsavg number of samples used to display hashrate (default: 30)
--no-gbt disable getblocktemplate support (height check in solo)
--no-longpoll disable X-Long-Polling support
--no-stratum disable X-Stratum support
-q, --quiet disable per-thread hashmeter output
@ -176,6 +178,7 @@ features. @@ -176,6 +178,7 @@ features.
Multiple shares support (2 for the moment)
X11 optimisations (From klaust and sp-hash)
HTML5 WebSocket api compatibility (see api/websocket.htm)
Solo mode height checks with getblocktemplate rpc calls
Nov. 27th 2014 v1.5.0
Upgrade compat jansson to 2.6 (for windows)

27
ccminer.cpp

@ -311,7 +311,8 @@ Options:\n\ @@ -311,7 +311,8 @@ Options:\n\
-T, --timeout=N network timeout, in seconds (default: 270)\n\
-s, --scantime=N upper bound on time spent scanning current work when\n\
long polling is unavailable, in seconds (default: 5)\n\
-N, --statsavg number of samples used to display hashrate (default: 20)\n\
-N, --statsavg number of samples used to display hashrate (default: 30)\n\
--no-gbt disable getblocktemplate support (height check in solo)\n\
--no-longpoll disable X-Long-Polling support\n\
--no-stratum disable X-Stratum support\n\
-q, --quiet disable per-thread hashmeter output\n\
@ -360,6 +361,7 @@ static struct option const options[] = { @@ -360,6 +361,7 @@ static struct option const options[] = {
{ "help", 0, NULL, 'h' },
{ "intensity", 1, NULL, 'i' },
{ "no-color", 0, NULL, 1002 },
{ "no-gbt", 0, NULL, 1011 },
{ "no-longpoll", 0, NULL, 1003 },
{ "no-stratum", 0, NULL, 1007 },
{ "pass", 1, NULL, 'p' },
@ -391,6 +393,8 @@ static struct work _ALIGN(64) g_work; @@ -391,6 +393,8 @@ static struct work _ALIGN(64) g_work;
static time_t g_work_time;
static pthread_mutex_t g_work_lock;
static bool get_blocktemplate(CURL *curl, struct work *work);
void get_currentalgo(char* buf, int sz)
{
snprintf(buf, sz, "%s", algo_names[opt_algo]);
@ -553,8 +557,8 @@ static bool submit_upstream_work(CURL *curl, struct work *work) @@ -553,8 +557,8 @@ static bool submit_upstream_work(CURL *curl, struct work *work)
bool stale_work = false;
char s[384];
/* discard if a new bloc was sent */
stale_work = work->height != g_work.height;
/* discard if a newer bloc was received */
stale_work = work->height && work->height < g_work.height;
if (have_stratum && !stale_work) {
pthread_mutex_lock(&g_work_lock);
if (strlen(work->job_id + 8))
@ -562,6 +566,17 @@ static bool submit_upstream_work(CURL *curl, struct work *work) @@ -562,6 +566,17 @@ static bool submit_upstream_work(CURL *curl, struct work *work)
pthread_mutex_unlock(&g_work_lock);
}
if (!have_stratum && !stale_work && allow_gbt) {
struct work wheight = { 0 };
if (get_blocktemplate(curl, &wheight)) {
if (work->height && work->height < wheight.height) {
if (opt_debug)
applog(LOG_WARNING, "bloc %u was already solved", work->height, wheight.height);
return true;
}
}
}
if (stale_work) {
if (opt_debug)
applog(LOG_WARNING, "stale work detected, discarding");
@ -677,9 +692,10 @@ static bool gbt_work_decode(const json_t *val, struct work *work) @@ -677,9 +692,10 @@ static bool gbt_work_decode(const json_t *val, struct work *work)
json_t *key = json_object_get(val, "height");
if (key && json_is_integer(key)) {
work->height = (uint32_t) json_integer_value(key);
if (!opt_quiet && work->height != g_work.height) {
if (!opt_quiet && work->height > g_work.height) {
applog(LOG_BLUE, "%s %s block %d", short_url,
algo_names[opt_algo], work->height);
g_work.height = work->height;
}
}
}
@ -1960,6 +1976,9 @@ static void parse_arg(int key, char *arg) @@ -1960,6 +1976,9 @@ static void parse_arg(int key, char *arg)
case 1007:
want_stratum = false;
break;
case 1011:
allow_gbt = false;
break;
case 'S':
case 1008:
applog(LOG_INFO, "Now logging to syslog...");

Loading…
Cancel
Save