1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-02-02 10:04:33 +00:00

Correct nonce submitted with share.

This commit is contained in:
Con Kolivas 2012-09-30 16:47:06 +10:00
parent 41acd23d0f
commit 6593b89328

View File

@ -2725,8 +2725,9 @@ static void *submit_work_thread(void *userdata)
if (work->stratum) {
struct stratum_share *sshare = calloc(sizeof(struct stratum_share), 1);
uint32_t *hash32 = (uint32_t *)work->hash;
uint32_t *hash32 = (uint32_t *)work->hash, nonce;
char *s = alloca(1024);
char *noncehex;
sprintf(sshare->hash6, "%08lx", (unsigned long)hash32[6]);
sshare->block = work->block;
@ -2737,8 +2738,12 @@ static void *submit_work_thread(void *userdata)
HASH_ADD_INT(stratum_shares, id, sshare);
mutex_unlock(&sshare_lock);
sprintf(s, "{\"params\": [\"%s\", \"%s\", \"%s\", \"%s\", \"%08lx\"], \"id\": %d, \"method\": \"mining.submit\"}",
pool->rpc_user, work->job_id, work->nonce2, work->ntime, (unsigned long)htobe32(work->blk.nonce), sshare->id);
nonce = *((uint32_t *)(work->data + 76));
noncehex = bin2hex((const unsigned char *)&nonce, 4);
sprintf(s, "{\"params\": [\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\": %d, \"method\": \"mining.submit\"}",
pool->rpc_user, work->job_id, work->nonce2, work->ntime, noncehex, sshare->id);
free(noncehex);
sock_send(pool->sock, s, strlen(s));