Skip to content

Commit e43d1bd

Browse files
committed
Bugfix
1 parent d64eb48 commit e43d1bd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cpu-miner.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ static void *miner_thread(void *userdata) {
10271027
if (opt_algo == ALGO_SCRYPT) {
10281028
scratchbuf = scrypt_buffer_alloc();
10291029
}
1030-
uint32_t *nonceptr = (uint32_t*) (((char*)work.data) + (opt_algo == ALGO_CRYPTONIGHT ? 39 : 76));
1030+
uint32_t *nonceptr = (uint32_t*) (((char*)work.data) + (jsonrpc_2 ? 39 : 76));
10311031

10321032
while (1) {
10331033
unsigned long hashes_done;
@@ -1040,7 +1040,8 @@ static void *miner_thread(void *userdata) {
10401040
sleep(1);
10411041
pthread_mutex_lock(&g_work_lock);
10421042
if ((*nonceptr) >= end_nonce
1043-
&& !memcmp(work.data, g_work.data, 76))
1043+
&& !(jsonrpc_2 ? memcmp(work.data, g_work.data, 39)
1044+
: memcmp(work.data, g_work.data, 76)))
10441045
stratum_gen_work(&stratum, &g_work);
10451046
} else {
10461047
/* obtain new work from internal workio thread */
@@ -1062,9 +1063,10 @@ static void *miner_thread(void *userdata) {
10621063
continue;
10631064
}
10641065
}
1065-
if (memcmp(work.data, g_work.data, 76)) {
1066+
if (jsonrpc_2 ? memcmp(work.data, g_work.data, 39) : memcmp(work.data, g_work.data, 76)) {
10661067
work_free(&work);
10671068
work_copy(&work, &g_work);
1069+
nonceptr = (uint32_t*) (((char*)work.data) + (jsonrpc_2 ? 39 : 76));
10681070
*nonceptr = 0xffffffffU / opt_n_threads * thr_id;
10691071
} else
10701072
++(*nonceptr);

0 commit comments

Comments
 (0)