|
|
|
@ -379,25 +379,8 @@ static void sharelog(const char*disposition, const struct work*work)
@@ -379,25 +379,8 @@ static void sharelog(const char*disposition, const struct work*work)
|
|
|
|
|
pool = work->pool; |
|
|
|
|
t = (unsigned long int)(work->tv_work_found.tv_sec); |
|
|
|
|
target = bin2hex(work->target, sizeof(work->target)); |
|
|
|
|
if (unlikely(!target)) { |
|
|
|
|
applog(LOG_ERR, "sharelog target OOM"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
hash = bin2hex(work->hash, sizeof(work->hash)); |
|
|
|
|
if (unlikely(!hash)) { |
|
|
|
|
free(target); |
|
|
|
|
applog(LOG_ERR, "sharelog hash OOM"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
data = bin2hex(work->data, sizeof(work->data)); |
|
|
|
|
if (unlikely(!data)) { |
|
|
|
|
free(target); |
|
|
|
|
free(hash); |
|
|
|
|
applog(LOG_ERR, "sharelog data OOM"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// timestamp,disposition,target,pool,dev,thr,sharehash,sharedata
|
|
|
|
|
rv = snprintf(s, sizeof(s), "%lu,%s,%s,%s,%s%u,%u,%s,%s\n", t, disposition, target, pool->rpc_url, cgpu->api->name, cgpu->device_id, thr_id, hash, data); |
|
|
|
@ -2022,10 +2005,6 @@ static bool submit_upstream_work(struct work *work, CURL *curl, bool resubmit)
@@ -2022,10 +2005,6 @@ static bool submit_upstream_work(struct work *work, CURL *curl, bool resubmit)
|
|
|
|
|
|
|
|
|
|
/* build hex string */ |
|
|
|
|
hexstr = bin2hex(work->data, sizeof(work->data)); |
|
|
|
|
if (unlikely(!hexstr)) { |
|
|
|
|
applog(LOG_ERR, "submit_upstream_work OOM"); |
|
|
|
|
goto out_nofree; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* build JSON-RPC request */ |
|
|
|
|
sprintf(s, |
|
|
|
@ -2137,7 +2116,6 @@ static bool submit_upstream_work(struct work *work, CURL *curl, bool resubmit)
@@ -2137,7 +2116,6 @@ static bool submit_upstream_work(struct work *work, CURL *curl, bool resubmit)
|
|
|
|
|
rc = true; |
|
|
|
|
out: |
|
|
|
|
free(hexstr); |
|
|
|
|
out_nofree: |
|
|
|
|
return rc; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -3158,10 +3136,6 @@ static inline bool from_existing_block(struct work *work)
@@ -3158,10 +3136,6 @@ static inline bool from_existing_block(struct work *work)
|
|
|
|
|
char *hexstr = bin2hex(work->data + 8, 18); |
|
|
|
|
bool ret; |
|
|
|
|
|
|
|
|
|
if (unlikely(!hexstr)) { |
|
|
|
|
applog(LOG_ERR, "from_existing_block OOM"); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
ret = block_exists(hexstr); |
|
|
|
|
free(hexstr); |
|
|
|
|
return ret; |
|
|
|
@ -3181,10 +3155,6 @@ static bool test_work_current(struct work *work)
@@ -3181,10 +3155,6 @@ static bool test_work_current(struct work *work)
|
|
|
|
|
return ret; |
|
|
|
|
|
|
|
|
|
hexstr = bin2hex(work->data + 8, 18); |
|
|
|
|
if (unlikely(!hexstr)) { |
|
|
|
|
applog(LOG_ERR, "stage_thread OOM"); |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Search to see if this block exists yet and if not, consider it a
|
|
|
|
|
* new block and set the current block details to this one */ |
|
|
|
@ -4645,10 +4615,8 @@ static void set_work_target(struct work *work, int diff)
@@ -4645,10 +4615,8 @@ static void set_work_target(struct work *work, int diff)
|
|
|
|
|
if (opt_debug) { |
|
|
|
|
char *htarget = bin2hex(target, 32); |
|
|
|
|
|
|
|
|
|
if (likely(htarget)) { |
|
|
|
|
applog(LOG_DEBUG, "Generated target %s", htarget); |
|
|
|
|
free(htarget); |
|
|
|
|
} |
|
|
|
|
applog(LOG_DEBUG, "Generated target %s", htarget); |
|
|
|
|
free(htarget); |
|
|
|
|
} |
|
|
|
|
memcpy(work->target, target, 32); |
|
|
|
|
} |
|
|
|
@ -4671,8 +4639,6 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
@@ -4671,8 +4639,6 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
|
|
|
|
|
|
|
|
|
|
/* Generate coinbase */ |
|
|
|
|
nonce2 = bin2hex((const unsigned char *)&pool->nonce2, pool->n2size); |
|
|
|
|
if (unlikely(!nonce2)) |
|
|
|
|
quit(1, "Failed to convert nonce2 in gen_stratum_work"); |
|
|
|
|
pool->nonce2++; |
|
|
|
|
cb1_len = strlen(pool->swork.coinbase1) / 2; |
|
|
|
|
n1_len = strlen(pool->nonce1) / 2; |
|
|
|
@ -4700,8 +4666,6 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
@@ -4700,8 +4666,6 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
|
|
|
|
|
for (i = 0; i < 32 / 4; i++) |
|
|
|
|
swap32[i] = swab32(data32[i]); |
|
|
|
|
merkle_hash = (unsigned char *)bin2hex((const unsigned char *)merkle_root, 32); |
|
|
|
|
if (unlikely(!merkle_hash)) |
|
|
|
|
quit(1, "Failed to conver merkle_hash in gen_stratum_work"); |
|
|
|
|
|
|
|
|
|
sprintf(header, "%s", pool->swork.bbversion); |
|
|
|
|
strcat(header, pool->swork.prev_hash); |
|
|
|
|