parent
2d92d6604b
commit
4611186cb8
1 changed files with 6 additions and 3 deletions
|
@ -661,19 +661,22 @@ static bool submit_upstream_work(CURL *curl, struct work *work)
|
||||||
|
|
||||||
if (have_stratum) {
|
if (have_stratum) {
|
||||||
uint32_t ntime, nonce;
|
uint32_t ntime, nonce;
|
||||||
char ntimestr[9], noncestr[9], *xnonce2str;
|
char ntimestr[9], noncestr[9], *xnonce2str, *req;
|
||||||
|
|
||||||
le32enc(&ntime, work->data[17]);
|
le32enc(&ntime, work->data[17]);
|
||||||
le32enc(&nonce, work->data[19]);
|
le32enc(&nonce, work->data[19]);
|
||||||
bin2hex(ntimestr, (const unsigned char *)(&ntime), 4);
|
bin2hex(ntimestr, (const unsigned char *)(&ntime), 4);
|
||||||
bin2hex(noncestr, (const unsigned char *)(&nonce), 4);
|
bin2hex(noncestr, (const unsigned char *)(&nonce), 4);
|
||||||
xnonce2str = abin2hex(work->xnonce2, work->xnonce2_len);
|
xnonce2str = abin2hex(work->xnonce2, work->xnonce2_len);
|
||||||
sprintf(s,
|
req = malloc(256 + strlen(rpc_user) + strlen(work->job_id) + 2 * work->xnonce2_len);
|
||||||
|
sprintf(req,
|
||||||
"{\"method\": \"mining.submit\", \"params\": [\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\":4}",
|
"{\"method\": \"mining.submit\", \"params\": [\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\":4}",
|
||||||
rpc_user, work->job_id, xnonce2str, ntimestr, noncestr);
|
rpc_user, work->job_id, xnonce2str, ntimestr, noncestr);
|
||||||
free(xnonce2str);
|
free(xnonce2str);
|
||||||
|
|
||||||
if (unlikely(!stratum_send_line(&stratum, s))) {
|
rc = stratum_send_line(&stratum, req);
|
||||||
|
free(req);
|
||||||
|
if (unlikely(!rc)) {
|
||||||
applog(LOG_ERR, "submit_upstream_work stratum_send_line failed");
|
applog(LOG_ERR, "submit_upstream_work stratum_send_line failed");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue