1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-27 23:14:21 +00:00

Set sshare id and swork_id within the sshare mutex to avoid multiple share submits with the same id.

This commit is contained in:
Con Kolivas 2012-10-29 21:28:15 +11:00
parent bbe5636ec4
commit e19c5d9db9

View File

@ -2920,11 +2920,10 @@ static void *submit_work_thread(void *userdata)
char *noncehex;
char s[1024];
/* Give the stratum share a unique id */
swork_id++;
memcpy(&sshare->work, work, sizeof(struct work));
mutex_lock(&sshare_lock);
sshare->id = swork_id;
/* Give the stratum share a unique id */
sshare->id = swork_id++;
HASH_ADD_INT(stratum_shares, id, sshare);
mutex_unlock(&sshare_lock);
@ -2932,7 +2931,7 @@ static void *submit_work_thread(void *userdata)
noncehex = bin2hex((const unsigned char *)&nonce, 4);
memset(s, 0, 1024);
sprintf(s, "{\"params\": [\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\": %d, \"method\": \"mining.submit\"}",
pool->rpc_user, work->job_id, work->nonce2, work->ntime, noncehex, swork_id);
pool->rpc_user, work->job_id, work->nonce2, work->ntime, noncehex, sshare->id);
free(noncehex);
applog(LOG_INFO, "Submitting share %08lx to pool %d", (unsigned long)(hash32[6]), pool->pool_no);