Export the roll_work function to be usable by driver code and make it compatible with rolling stratum work.
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
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);