Copy parameters from stratum work required for share submission.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
diff --git a/cgminer.c b/cgminer.c
index eaaba84..645414b 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -4320,7 +4320,6 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
nonce2 = bin2hex((const unsigned char *)&pool->nonce2, pool->n2size);
pool->nonce2++;
strcat(coinbase, nonce2);
- free(nonce2);
strcat(coinbase, pool->swork.coinbase2);
/* Generate merkle root */
@@ -4347,6 +4346,11 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
diff = pool->swork.diff;
+ /* Copy parameters required for share submission */
+ work->job_id = strdup(pool->swork.job_id);
+ work->nonce2 = nonce2;
+ work->ntime = pool->swork.ntime;
+
mutex_unlock(&pool->pool_lock);
applog(LOG_DEBUG, "Generated stratum coinbase %s", coinbase);
diff --git a/miner.h b/miner.h
index 7a1df40..c220b9c 100644
--- a/miner.h
+++ b/miner.h
@@ -880,7 +880,11 @@ struct work {
bool mandatory;
bool block;
bool queued;
+
bool stratum;
+ char *job_id;
+ char *nonce2;
+ char *ntime;
unsigned int work_block;
int id;