Commit a8a8ed6207eda600f2894e3809c7ea2250af43a4

Con Kolivas 2012-10-02T16:01:32

Correct target calculation in gen_stratum_work.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/cgminer.c b/cgminer.c
index bda5159..3b36946 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -4552,7 +4552,7 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
 		quit(1,  "Failed to convert hash1 in gen_stratum_work");
 
 	/* Generate target as hex where 0x00000000FFFFFFFF is diff 1 */
-	diff64 = 0x00000000FFFFFFFFULL * diff;
+	diff64 = (1Ull << (31 + diff)) - 1;
 	diff64 = ~htobe64(diff64);
 	sprintf(target, "ffffffffffffffffffffffffffffffffffffffffffffffff");
 	buf = bin2hex((const unsigned char *)&diff64, 8);