mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-02 10:04:33 +00:00
Check for GBT support on first probing the pool and convert to using the GBT request as the rpc request for that pool.
This commit is contained in:
parent
f4cc59f25f
commit
1c456d4fb3
17
cgminer.c
17
cgminer.c
@ -407,7 +407,7 @@ static void sharelog(const char*disposition, const struct work*work)
|
||||
|
||||
static char *getwork_req = "{\"method\": \"getwork\", \"params\": [], \"id\":0}\n";
|
||||
|
||||
// static char *gbt_req = "{\"id\": 0, \"method\": \"getblocktemplate\", \"params\": [{\"capabilities\": [\"coinbasetxn\", \"workid\", \"coinbase/append\"]}]}\n";
|
||||
static char *gbt_req = "{\"id\": 0, \"method\": \"getblocktemplate\", \"params\": [{\"capabilities\": [\"coinbasetxn\", \"workid\", \"coinbase/append\"]}]}\n";
|
||||
|
||||
/* Return value is ignored if not called from add_pool_details */
|
||||
struct pool *add_pool(void)
|
||||
@ -4441,6 +4441,21 @@ retry_stratum:
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Probe for GBT support on first pass */
|
||||
if (!pool->probed && !opt_fix_protocol) {
|
||||
applog(LOG_DEBUG, "Probing for GBT support");
|
||||
val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass,
|
||||
gbt_req, true, false, &rolltime, pool, false);
|
||||
if (val) {
|
||||
pool->has_gbt = true;
|
||||
pool->rpc_req = gbt_req;
|
||||
applog(LOG_DEBUG, "GBT support found, switching to GBT protocol");
|
||||
json_decref(val);
|
||||
} else
|
||||
applog(LOG_DEBUG, "No GBT support found, using getwork protocol");
|
||||
pool->probed = false;
|
||||
}
|
||||
|
||||
gettimeofday(&tv_getwork, NULL);
|
||||
val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass,
|
||||
pool->rpc_req, true, false, &rolltime, pool, false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user