Browse Source

Check for GBT support on first probing the pool and convert to using the GBT request as the rpc request for that pool.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
1c456d4fb3
  1. 17
      cgminer.c
  2. 3
      miner.h

17
cgminer.c

@ -407,7 +407,7 @@ static void sharelog(const char*disposition, const struct work*work) @@ -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: @@ -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);

3
miner.h

@ -883,6 +883,9 @@ struct pool { @@ -883,6 +883,9 @@ struct pool {
struct stratum_work swork;
pthread_t stratum_thread;
pthread_mutex_t stratum_lock;
/* GBT variables */
bool has_gbt;
};
#define GETWORK_MODE_TESTPOOL 'T'

Loading…
Cancel
Save