mirror of
https://github.com/GOSTSec/sgminer
synced 2025-08-26 05:41:55 +00:00
Check for both coinbase/append and submit/coinbase support before using GBT protocol.
This commit is contained in:
parent
878f4d53ab
commit
1d7e19f2f2
22
cgminer.c
22
cgminer.c
@ -4772,6 +4772,7 @@ retry_stratum:
|
|||||||
val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass,
|
val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass,
|
||||||
gbt_req, true, false, &rolltime, pool, false);
|
gbt_req, true, false, &rolltime, pool, false);
|
||||||
if (val) {
|
if (val) {
|
||||||
|
bool append = false, submit = false;
|
||||||
json_t *res_val, *mutables;
|
json_t *res_val, *mutables;
|
||||||
int i, mutsize = 0;
|
int i, mutsize = 0;
|
||||||
|
|
||||||
@ -4787,24 +4788,29 @@ retry_stratum:
|
|||||||
if (json_is_string(arrval)) {
|
if (json_is_string(arrval)) {
|
||||||
const char *mutable = json_string_value(arrval);
|
const char *mutable = json_string_value(arrval);
|
||||||
|
|
||||||
/* Only use GBT if it supports coinbase append */
|
if (!strncasecmp(mutable, "coinbase/append", 15))
|
||||||
if (!strncasecmp(mutable, "coinbase/append", 15)) {
|
append = true;
|
||||||
pool->has_gbt = true;
|
else if (!strncasecmp(mutable, "submit/coinbase", 15))
|
||||||
pool->rpc_req = gbt_req;
|
submit = true;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
json_decref(val);
|
json_decref(val);
|
||||||
|
|
||||||
|
/* Only use GBT if it supports coinbase append and
|
||||||
|
* submit coinbase */
|
||||||
|
if (append && submit) {
|
||||||
|
pool->has_gbt = true;
|
||||||
|
pool->rpc_req = gbt_req;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* Reset this so we can probe fully just after this. It will be
|
/* Reset this so we can probe fully just after this. It will be
|
||||||
* set to true that time.*/
|
* set to true that time.*/
|
||||||
pool->probed = false;
|
pool->probed = false;
|
||||||
|
|
||||||
if (pool->has_gbt)
|
if (pool->has_gbt)
|
||||||
applog(LOG_DEBUG, "GBT coinbase append support found, switching to GBT protocol");
|
applog(LOG_DEBUG, "GBT coinbase + append support found, switching to GBT protocol");
|
||||||
else
|
else
|
||||||
applog(LOG_DEBUG, "No GBT coinbase append support found, using getwork protocol");
|
applog(LOG_DEBUG, "No GBT coinbase + append support found, using getwork protocol");
|
||||||
}
|
}
|
||||||
|
|
||||||
gettimeofday(&tv_getwork, NULL);
|
gettimeofday(&tv_getwork, NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user