@@ -1027,7 +1027,7 @@ static void *miner_thread(void *userdata) {
1027
1027
if (opt_algo == ALGO_SCRYPT ) {
1028
1028
scratchbuf = scrypt_buffer_alloc ();
1029
1029
}
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 ));
1031
1031
1032
1032
while (1 ) {
1033
1033
unsigned long hashes_done ;
@@ -1040,7 +1040,8 @@ static void *miner_thread(void *userdata) {
1040
1040
sleep (1 );
1041
1041
pthread_mutex_lock (& g_work_lock );
1042
1042
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 )))
1044
1045
stratum_gen_work (& stratum , & g_work );
1045
1046
} else {
1046
1047
/* obtain new work from internal workio thread */
@@ -1062,9 +1063,10 @@ static void *miner_thread(void *userdata) {
1062
1063
continue ;
1063
1064
}
1064
1065
}
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 )) {
1066
1067
work_free (& work );
1067
1068
work_copy (& work , & g_work );
1069
+ nonceptr = (uint32_t * ) (((char * )work .data ) + (jsonrpc_2 ? 39 : 76 ));
1068
1070
* nonceptr = 0xffffffffU / opt_n_threads * thr_id ;
1069
1071
} else
1070
1072
++ (* nonceptr );
0 commit comments