Commit 73932de08fc6a852d06db744bddc2acfcc351025

Con Kolivas 2014-03-16T23:03:17

Move swork.diff out of the stratum work section to be shared as sdiff.

diff --git a/cgminer.c b/cgminer.c
index 10a3738..f40b0bc 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -5932,7 +5932,7 @@ static bool parse_stratum_response(struct pool *pool, char *s)
 		/* Since the share is untracked, we can only guess at what the
 		 * work difficulty is based on the current pool diff. */
 		cg_rlock(&pool->data_lock);
-		pool_diff = pool->swork.diff;
+		pool_diff = pool->sdiff;
 		cg_runlock(&pool->data_lock);
 
 		if (json_is_true(res_val)) {
@@ -6801,7 +6801,7 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
 
 	/* Store the stratum work diff to check it still matches the pool's
 	 * stratum diff when submitting shares */
-	work->sdiff = pool->swork.diff;
+	work->sdiff = pool->sdiff;
 
 	/* Copy parameters required for share submission */
 	work->job_id = strdup(pool->swork.job_id);
diff --git a/miner.h b/miner.h
index 008688a..2fdc828 100644
--- a/miner.h
+++ b/miner.h
@@ -1267,6 +1267,7 @@ struct pool {
 	char bbversion[12];
 	char nbit[12];
 	char ntime[12];
+	double sdiff;
 
 	struct timeval tv_lastwork;
 };
diff --git a/util.c b/util.c
index a70b611..2143641 100644
--- a/util.c
+++ b/util.c
@@ -1755,8 +1755,8 @@ static bool parse_diff(struct pool *pool, json_t *val)
 		return false;
 
 	cg_wlock(&pool->data_lock);
-	old_diff = pool->swork.diff;
-	pool->swork.diff = diff;
+	old_diff = pool->sdiff;
+	pool->sdiff = diff;
 	cg_wunlock(&pool->data_lock);
 
 	if (old_diff != diff) {
@@ -2499,7 +2499,7 @@ out:
 		if (!pool->stratum_url)
 			pool->stratum_url = pool->sockaddr_url;
 		pool->stratum_active = true;
-		pool->swork.diff = 1;
+		pool->sdiff = 1;
 		if (opt_protocol) {
 			applog(LOG_DEBUG, "Pool %d confirmed mining.subscribe with extranonce1 %s extran2size %d",
 			       pool->pool_no, pool->nonce1, pool->n2size);