Browse Source

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

Con Kolivas 13 years ago
parent
commit
2fb6637b5a
2 changed files with 4 additions and 3 deletions
  1. 3 3
      cgminer.c
  2. 1 0
      miner.h

+ 3 - 3
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;

+ 1 - 0
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);