mirror of
https://github.com/GOSTSec/ccminer
synced 2025-01-22 12:34:17 +00:00
longpoll: auto disable gbt when not supported
This commit is contained in:
parent
4acb9c5743
commit
7f00bce5ae
11
ccminer.cpp
11
ccminer.cpp
@ -740,11 +740,18 @@ static bool get_blocktemplate(CURL *curl, struct work *work)
|
||||
if (!allow_gbt)
|
||||
return false;
|
||||
|
||||
int curl_err = 0;
|
||||
json_t *val = json_rpc_call(curl, rpc_url, rpc_userpass, gbt_req,
|
||||
want_longpoll, false, NULL);
|
||||
want_longpoll, have_longpoll, &curl_err);
|
||||
|
||||
if (!val)
|
||||
if (!val && curl_err == -1) {
|
||||
// when getblocktemplate is not supported, disable it
|
||||
allow_gbt = false;
|
||||
if (!opt_quiet) {
|
||||
applog(LOG_BLUE, "gbt not supported, block height notices disabled");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool rc = gbt_work_decode(json_object_get(val, "result"), work);
|
||||
|
||||
|
13
util.cpp
13
util.cpp
@ -526,11 +526,22 @@ json_t *json_rpc_call(CURL *curl, const char *url,
|
||||
|
||||
if (err_val) {
|
||||
json_t *msg = json_object_get(err_val, "message");
|
||||
s = json_dumps(err_val, JSON_INDENT(3));
|
||||
json_t *err_code = json_object_get(err_val, "code");
|
||||
if (curl_err && json_integer_value(err_code))
|
||||
*curl_err = (int) json_integer_value(err_code);
|
||||
json_decref(err_code);
|
||||
|
||||
s = json_dumps(err_val, 0);
|
||||
if (json_is_string(msg)) {
|
||||
free(s);
|
||||
s = strdup(json_string_value(msg));
|
||||
if (have_longpoll && s && !strcmp(s, "method not getwork")) {
|
||||
json_decref(err_val);
|
||||
free(s);
|
||||
goto err_out;
|
||||
}
|
||||
}
|
||||
json_decref(err_val);
|
||||
}
|
||||
else
|
||||
s = strdup("(unknown reason)");
|
||||
|
Loading…
x
Reference in New Issue
Block a user