Browse Source

Handle the getwork typo in neoscrypt wallets

allow solo mining neoscrypt coins... (FTC/UFO)
master
Tanguy Pruvot 9 years ago
parent
commit
8ec5dd7d8e
  1. 23
      ccminer.cpp

23
ccminer.cpp

@ -620,16 +620,26 @@ static void calc_network_diff(struct work *work)
net_diff = d; net_diff = d;
} }
/* decode data from getwork (wallets and longpoll pools) */
static bool work_decode(const json_t *val, struct work *work) static bool work_decode(const json_t *val, struct work *work)
{ {
int data_size = sizeof(work->data), target_size = sizeof(work->target); int data_size, target_size = sizeof(work->target);
int adata_sz = ARRAY_SIZE(work->data), atarget_sz = ARRAY_SIZE(work->target); int adata_sz, atarget_sz = ARRAY_SIZE(work->target);
int i; int i;
if (opt_algo == ALGO_NEOSCRYPT || opt_algo == ALGO_ZR5) { switch (opt_algo) {
data_size = 80; adata_sz = 20; case ALGO_ZR5:
data_size = 80;
break;
case ALGO_NEOSCRYPT:
data_size = 84; // typo in FTC wallet ? and clones..
break;
default:
data_size = 128; // sizeof(work->data);
} }
adata_sz = data_size / 4; // sizeof(uint32_t);
if (unlikely(!jobj_binary(val, "data", work->data, data_size))) { if (unlikely(!jobj_binary(val, "data", work->data, data_size))) {
applog(LOG_ERR, "JSON inval data"); applog(LOG_ERR, "JSON inval data");
return false; return false;
@ -655,6 +665,9 @@ static bool work_decode(const json_t *val, struct work *work)
work->targetdiff = target_to_diff(work->target); work->targetdiff = target_to_diff(work->target);
// for api stats, on longpoll pools
stratum_diff = work->targetdiff;
work->tx_count = use_pok = 0; work->tx_count = use_pok = 0;
if (work->data[0] & POK_BOOL_MASK) { if (work->data[0] & POK_BOOL_MASK) {
use_pok = 1; use_pok = 1;
@ -2111,6 +2124,8 @@ longpoll_retry:
if (net_diff > 0.) { if (net_diff > 0.) {
sprintf(netinfo, ", diff %.3f", net_diff); sprintf(netinfo, ", diff %.3f", net_diff);
} }
if (opt_showdiff)
sprintf(&netinfo[strlen(netinfo)], ", target %.3f", g_work.targetdiff);
applog(LOG_BLUE, "%s detected new block%s", short_url, netinfo); applog(LOG_BLUE, "%s detected new block%s", short_url, netinfo);
} }
g_work_time = time(NULL); g_work_time = time(NULL);

Loading…
Cancel
Save