mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Provide support for the submitold extension on a per-pool basis based on the value being detected in a longpoll.
This commit is contained in:
parent
1dff4297fa
commit
de4c6c29d7
20
cgminer.c
20
cgminer.c
@ -1740,11 +1740,17 @@ static void *submit_work_thread(void *userdata)
|
|||||||
|
|
||||||
pthread_detach(pthread_self());
|
pthread_detach(pthread_self());
|
||||||
|
|
||||||
if (!opt_submit_stale && stale_work(work, true)) {
|
if (stale_work(work, true)) {
|
||||||
applog(LOG_NOTICE, "Stale share detected, discarding");
|
|
||||||
total_stale++;
|
total_stale++;
|
||||||
pool->stale_shares++;
|
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 */
|
/* submit solution to bitcoin via JSON-RPC */
|
||||||
@ -3378,7 +3384,6 @@ static void *longpoll_thread(void *userdata)
|
|||||||
CURL *curl = NULL;
|
CURL *curl = NULL;
|
||||||
int failures = 0;
|
int failures = 0;
|
||||||
bool rolltime;
|
bool rolltime;
|
||||||
json_t *val;
|
|
||||||
|
|
||||||
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
||||||
pthread_detach(pthread_self());
|
pthread_detach(pthread_self());
|
||||||
@ -3420,10 +3425,17 @@ new_longpoll:
|
|||||||
applog(LOG_WARNING, "Long-polling activated for %s", lp_url);
|
applog(LOG_WARNING, "Long-polling activated for %s", lp_url);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
json_t *val, *soval;
|
||||||
|
|
||||||
gettimeofday(&start, NULL);
|
gettimeofday(&start, NULL);
|
||||||
val = json_rpc_call(curl, lp_url, pool->rpc_userpass, rpc_req,
|
val = json_rpc_call(curl, lp_url, pool->rpc_userpass, rpc_req,
|
||||||
false, true, &rolltime, pool, false);
|
false, true, &rolltime, pool, false);
|
||||||
if (likely(val)) {
|
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);
|
convert_to_work(val, rolltime, pool);
|
||||||
failures = 0;
|
failures = 0;
|
||||||
json_decref(val);
|
json_decref(val);
|
||||||
|
1
miner.h
1
miner.h
@ -626,6 +626,7 @@ struct pool {
|
|||||||
bool lagging;
|
bool lagging;
|
||||||
bool probed;
|
bool probed;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
|
bool submit_old;
|
||||||
|
|
||||||
char *hdr_path;
|
char *hdr_path;
|
||||||
|
|
||||||
|
2
util.c
2
util.c
@ -374,7 +374,7 @@ json_t *json_rpc_call(CURL *curl, const char *url,
|
|||||||
headers = curl_slist_append(headers,
|
headers = curl_slist_append(headers,
|
||||||
"Content-type: application/json");
|
"Content-type: application/json");
|
||||||
headers = curl_slist_append(headers,
|
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, len_hdr);
|
||||||
headers = curl_slist_append(headers, user_agent_hdr);
|
headers = curl_slist_append(headers, user_agent_hdr);
|
||||||
headers = curl_slist_append(headers, "Expect:"); /* disable Expect hdr*/
|
headers = curl_slist_append(headers, "Expect:"); /* disable Expect hdr*/
|
||||||
|
Loading…
Reference in New Issue
Block a user