Commit 2de813550ff3b5830d2faa512aeb87e6f3ad1c90

Con Kolivas 2014-03-08T10:35:45

Export the roll_work function to be usable by driver code and make it compatible with rolling stratum work.

diff --git a/cgminer.c b/cgminer.c
index bd0ce11..6a5c3b0 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -3697,7 +3697,9 @@ static inline bool can_roll(struct work *work)
 		work->rolls < 7000 && !stale_work(work, false));
 }
 
-static void roll_work(struct work *work)
+static char *offset_ntime(const char *ntime, int noffset);
+
+void roll_work(struct work *work)
 {
 	uint32_t *work_ntime;
 	uint32_t ntime;
@@ -3710,6 +3712,9 @@ static void roll_work(struct work *work)
 	work->rolls++;
 	work->nonce = 0;
 	applog(LOG_DEBUG, "Successfully rolled work");
+	/* Change the ntime field if this is stratum work */
+	if (work->ntime)
+		work->ntime = offset_ntime(work->ntime, 1);
 
 	/* This is now a different work item so it needs a different ID for the
 	 * hashtable */
diff --git a/miner.h b/miner.h
index 640029c..c3d4512 100644
--- a/miner.h
+++ b/miner.h
@@ -1421,6 +1421,7 @@ extern void tq_thaw(struct thread_q *tq);
 extern bool successful_connect;
 extern void adl(void);
 extern void app_restart(void);
+extern void roll_work(struct work *work);
 extern void clean_work(struct work *work);
 extern void free_work(struct work *work);
 extern void set_work_ntime(struct work *work, int ntime);