Commit 2fb6637b5ae91da825e5ed349f543cac3630998a

Con Kolivas 2013-05-11T19:51:43

Make set_work_target a function to set a specified char as target for use elsewhere.

diff --git a/cgminer.c b/cgminer.c
index 4e79c5e..04d00db 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -5280,7 +5280,7 @@ static void gen_hash(unsigned char *data, unsigned char *hash, int len)
  * 0x00000000ffff0000000000000000000000000000000000000000000000000000
  * so we use a big endian 64 bit unsigned integer centred on the 5th byte to
  * cover a huge range of difficulty targets, though not all 256 bits' worth */
-static void set_work_target(struct work *work, double diff)
+void set_target(unsigned char *dest_target, double diff)
 {
 	unsigned char target[32];
 	uint64_t *data64, h64;
@@ -5315,7 +5315,7 @@ static void set_work_target(struct work *work, double diff)
 		applog(LOG_DEBUG, "Generated target %s", htarget);
 		free(htarget);
 	}
-	memcpy(work->target, target, 32);
+	memcpy(dest_target, target, 32);
 }
 
 /* Generates stratum based work based on the most recent notify information
@@ -5399,7 +5399,7 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
 	free(header);
 	calc_midstate(work);
 
-	set_work_target(work, work->sdiff);
+	set_target(work->target, work->sdiff);
 
 	local_work++;
 	work->pool = pool;
diff --git a/miner.h b/miner.h
index 595cc5e..d76b44c 100644
--- a/miner.h
+++ b/miner.h
@@ -894,6 +894,7 @@ extern pthread_cond_t restart_cond;
 
 extern void thread_reportin(struct thr_info *thr);
 extern void clear_stratum_shares(struct pool *pool);
+extern void set_target(unsigned char *dest_target, double diff);
 extern int restart_wait(unsigned int mstime);
 
 extern void kill_work(void);