Browse Source

Provide support for the submitold extension on a per-pool basis based on the value being detected in a longpoll.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
de4c6c29d7
  1. 20
      cgminer.c
  2. 1
      miner.h
  3. 2
      util.c

20
cgminer.c

@ -1740,11 +1740,17 @@ static void *submit_work_thread(void *userdata) @@ -1740,11 +1740,17 @@ static void *submit_work_thread(void *userdata)
pthread_detach(pthread_self());
if (!opt_submit_stale && stale_work(work, true)) {
applog(LOG_NOTICE, "Stale share detected, discarding");
if (stale_work(work, true)) {
total_stale++;
pool->stale_shares++;
goto out;
if (!opt_submit_stale && !pool->submit_old) {
applog(LOG_NOTICE, "Stale share detected, discarding");
goto out;
}
if (opt_submit_stale)
applog(LOG_NOTICE, "Stale share detected, submitting as user requested");
else if (pool->submit_old)
applog(LOG_NOTICE, "Stale share detected, submitting as pool requested");
}
/* submit solution to bitcoin via JSON-RPC */
@ -3378,7 +3384,6 @@ static void *longpoll_thread(void *userdata) @@ -3378,7 +3384,6 @@ static void *longpoll_thread(void *userdata)
CURL *curl = NULL;
int failures = 0;
bool rolltime;
json_t *val;
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
pthread_detach(pthread_self());
@ -3420,10 +3425,17 @@ new_longpoll: @@ -3420,10 +3425,17 @@ new_longpoll:
applog(LOG_WARNING, "Long-polling activated for %s", lp_url);
while (1) {
json_t *val, *soval;
gettimeofday(&start, NULL);
val = json_rpc_call(curl, lp_url, pool->rpc_userpass, rpc_req,
false, true, &rolltime, pool, false);
if (likely(val)) {
soval = json_object_get(json_object_get(val, "result"), "submitold");
if (soval)
pool->submit_old = json_is_true(soval);
else
pool->submit_old = false;
convert_to_work(val, rolltime, pool);
failures = 0;
json_decref(val);

1
miner.h

@ -626,6 +626,7 @@ struct pool { @@ -626,6 +626,7 @@ struct pool {
bool lagging;
bool probed;
bool enabled;
bool submit_old;
char *hdr_path;

2
util.c

@ -374,7 +374,7 @@ json_t *json_rpc_call(CURL *curl, const char *url, @@ -374,7 +374,7 @@ json_t *json_rpc_call(CURL *curl, const char *url,
headers = curl_slist_append(headers,
"Content-type: application/json");
headers = curl_slist_append(headers,
"X-Mining-Extensions: longpoll midstate rollntime");
"X-Mining-Extensions: longpoll midstate rollntime submitold");
headers = curl_slist_append(headers, len_hdr);
headers = curl_slist_append(headers, user_agent_hdr);
headers = curl_slist_append(headers, "Expect:"); /* disable Expect hdr*/

Loading…
Cancel
Save