Make set_work_target a function to set a specified char as target for use elsewhere.
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 41 42 43
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);