Skip to content

Commit

Permalink
Handle the getwork typo in neoscrypt wallets
Browse files Browse the repository at this point in the history
allow solo mining neoscrypt coins... (FTC/UFO)
  • Loading branch information
tpruvot committed Sep 24, 2015
1 parent ec054db commit 8ec5dd7
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions ccminer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,16 +620,26 @@ static void calc_network_diff(struct work *work)
net_diff = d;
}

/* decode data from getwork (wallets and longpoll pools) */
static bool work_decode(const json_t *val, struct work *work)
{
int data_size = sizeof(work->data), target_size = sizeof(work->target);
int adata_sz = ARRAY_SIZE(work->data), atarget_sz = ARRAY_SIZE(work->target);
int data_size, target_size = sizeof(work->target);
int adata_sz, atarget_sz = ARRAY_SIZE(work->target);
int i;

if (opt_algo == ALGO_NEOSCRYPT || opt_algo == ALGO_ZR5) {
data_size = 80; adata_sz = 20;
switch (opt_algo) {
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))) {
applog(LOG_ERR, "JSON inval data");
return false;
Expand All @@ -655,6 +665,9 @@ static bool work_decode(const json_t *val, struct work *work)

work->targetdiff = target_to_diff(work->target);

// for api stats, on longpoll pools
stratum_diff = work->targetdiff;

work->tx_count = use_pok = 0;
if (work->data[0] & POK_BOOL_MASK) {
use_pok = 1;
Expand Down Expand Up @@ -2111,6 +2124,8 @@ static void *longpoll_thread(void *userdata)
if (net_diff > 0.) {
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);
}
g_work_time = time(NULL);
Expand Down

0 comments on commit 8ec5dd7

Please sign in to comment.