xmr: nicehash nonce prefix/hack support (v2)
This commit is contained in:
parent
def9888bd5
commit
dc816b4673
15
ccminer.cpp
15
ccminer.cpp
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2010 Jeff Garzik
|
||||
* Copyright 2012-2014 pooler
|
||||
* Copyright 2014-2015 tpruvot
|
||||
* Copyright 2014-2017 tpruvot
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
@ -1869,15 +1869,24 @@ static void *miner_thread(void *userdata)
|
||||
|
||||
if (opt_algo == ALGO_CRYPTONIGHT || opt_algo == ALGO_CRYPTOLIGHT) {
|
||||
uint32_t oldpos = nonceptr[0];
|
||||
bool nicehash = strstr(pools[cur_pooln].url, "nicehash") != NULL;
|
||||
if (memcmp(&work.data[wcmpoft], &g_work.data[wcmpoft], wcmplen)) {
|
||||
memcpy(&work, &g_work, sizeof(struct work));
|
||||
nonceptr[0] = (UINT32_MAX / opt_n_threads) * thr_id; // reset cursor
|
||||
if (!nicehash) nonceptr[0] = (rand()*4) << 24;
|
||||
nonceptr[0] &= 0xFF000000u; // nicehash prefix hack
|
||||
nonceptr[0] |= (0x00FFFFFFu / opt_n_threads) * thr_id;
|
||||
}
|
||||
// also check the end, nonce in the middle
|
||||
else if (memcmp(&work.data[44/4], &g_work.data[0], 76-44)) {
|
||||
memcpy(&work, &g_work, sizeof(struct work));
|
||||
}
|
||||
if (oldpos & 0xFFFF) nonceptr[0] = oldpos + 0x100000;
|
||||
if (oldpos & 0xFFFF) {
|
||||
if (!nicehash) nonceptr[0] = oldpos + 0x1000000u;
|
||||
else {
|
||||
uint32_t pfx = nonceptr[0] & 0xFF000000u;
|
||||
nonceptr[0] = pfx | ((oldpos + 0x8000u) & 0xFFFFFFu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (memcmp(&work.data[wcmpoft], &g_work.data[wcmpoft], wcmplen)) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* XMR RPC 2.0 Specific Stuff
|
||||
* XMR RPC 2.0 Stratum and BBR Scratchpad
|
||||
* tpruvot@github - October 2016
|
||||
*/
|
||||
|
||||
@ -54,7 +54,7 @@ bool jobj_binary(const json_t *obj, const char *key, void *buf, size_t buflen);
|
||||
pthread_mutex_t rpc2_job_lock;
|
||||
pthread_mutex_t rpc2_work_lock;
|
||||
pthread_mutex_t rpc2_login_lock;
|
||||
pthread_mutex_t rpc2_getscratchpad_lock;
|
||||
//pthread_mutex_t rpc2_getscratchpad_lock;
|
||||
|
||||
char* opt_scratchpad_url = NULL;
|
||||
uint64_t* pscratchpad_buff = NULL;
|
||||
@ -1310,5 +1310,5 @@ void rpc2_init()
|
||||
pthread_mutex_init(&rpc2_job_lock, NULL);
|
||||
pthread_mutex_init(&rpc2_work_lock, NULL);
|
||||
pthread_mutex_init(&rpc2_login_lock, NULL);
|
||||
pthread_mutex_init(&rpc2_getscratchpad_lock, NULL);
|
||||
//pthread_mutex_init(&rpc2_getscratchpad_lock, NULL);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user