Browse Source

Merge commit '7e8019a' into cg_merges_20130304a

Conflicts:
	miner.c
Luke Dashjr 13 years ago
parent
commit
769f478aa3
1 changed files with 6 additions and 5 deletions
  1. 6 5
      miner.c

+ 6 - 5
miner.c

@@ -3868,17 +3868,18 @@ static struct submit_work_state *begin_submission(struct work *work)
 
 		sshare->sshare_time = time(NULL);
 		sshare->work = copy_work(work);
+		nonce = *((uint32_t *)(work->data + 76));
+		noncehex = bin2hex((const unsigned char *)&nonce, 4);
+		s = malloc(1024);
+
 		mutex_lock(&sshare_lock);
 		/* Give the stratum share a unique id */
 		sshare->id = swork_id++;
 		HASH_ADD_INT(stratum_shares, id, sshare);
-		mutex_unlock(&sshare_lock);
-
-		nonce = *((uint32_t *)(work->data + 76));
-		noncehex = bin2hex((const unsigned char *)&nonce, 4);
-		s = malloc(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, sshare->id);
+		mutex_unlock(&sshare_lock);
+
 		free(noncehex);
 
 		sws->s = s;