Fix nicehash support, please note --nicehash option now specified per pool.
This commit is contained in:
parent
263634f585
commit
8ec58a8394
12 changed files with 23 additions and 26 deletions
|
@ -85,7 +85,7 @@ void DoubleWorker::consumeJob()
|
|||
memcpy(m_blob, m_job.blob(), m_job.size());
|
||||
memcpy(m_blob + m_job.size(), m_job.blob(), m_job.size());
|
||||
|
||||
if (m_nicehash) {
|
||||
if (m_job.isNicehash()) {
|
||||
m_nonce1 = (*Job::nonce(m_blob) & 0xff000000U) + (0xffffffU / (m_threads * 2) * m_id);
|
||||
m_nonce2 = (*Job::nonce(m_blob + m_job.size()) & 0xff000000U) + (0xffffffU / (m_threads * 2) * (m_id + m_threads));
|
||||
}
|
||||
|
|
|
@ -25,8 +25,7 @@
|
|||
#include "workers/Handle.h"
|
||||
|
||||
|
||||
Handle::Handle(int threadId, int threads, int64_t affinity, bool nicehash) :
|
||||
m_nicehash(nicehash),
|
||||
Handle::Handle(int threadId, int threads, int64_t affinity) :
|
||||
m_threadId(threadId),
|
||||
m_threads(threads),
|
||||
m_affinity(affinity),
|
||||
|
|
|
@ -35,10 +35,9 @@ class IWorker;
|
|||
class Handle
|
||||
{
|
||||
public:
|
||||
Handle(int threadId, int threads, int64_t affinity, bool nicehash);
|
||||
Handle(int threadId, int threads, int64_t affinity);
|
||||
void start(void (*callback) (void *));
|
||||
|
||||
inline bool nicehash() const { return m_nicehash; }
|
||||
inline int threadId() const { return m_threadId; }
|
||||
inline int threads() const { return m_threads; }
|
||||
inline int64_t affinity() const { return m_affinity; }
|
||||
|
@ -46,7 +45,6 @@ public:
|
|||
inline void setWorker(IWorker *worker) { m_worker = worker; }
|
||||
|
||||
private:
|
||||
bool m_nicehash;
|
||||
int m_threadId;
|
||||
int m_threads;
|
||||
int64_t m_affinity;
|
||||
|
|
|
@ -77,7 +77,7 @@ void SingleWorker::consumeJob()
|
|||
memcpy(m_result.jobId, m_job.id(), sizeof(m_result.jobId));
|
||||
m_result.poolId = m_job.poolId();
|
||||
|
||||
if (m_nicehash) {
|
||||
if (m_job.isNicehash()) {
|
||||
m_result.nonce = (*m_job.nonce() & 0xff000000U) + (0xffffffU / m_threads * m_id);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
|
||||
Worker::Worker(Handle *handle) :
|
||||
m_nicehash(handle->nicehash()),
|
||||
m_id(handle->threadId()),
|
||||
m_threads(handle->threads()),
|
||||
m_hashCount(0),
|
||||
|
|
|
@ -48,7 +48,6 @@ public:
|
|||
protected:
|
||||
void storeStats();
|
||||
|
||||
bool m_nicehash;
|
||||
cryptonight_ctx *m_ctx;
|
||||
int m_id;
|
||||
int m_threads;
|
||||
|
|
|
@ -69,7 +69,7 @@ void Workers::setJob(const Job &job)
|
|||
}
|
||||
|
||||
|
||||
void Workers::start(int64_t affinity, bool nicehash)
|
||||
void Workers::start(int64_t affinity)
|
||||
{
|
||||
const int threads = Mem::threads();
|
||||
m_hashrate = new Hashrate(threads);
|
||||
|
@ -85,7 +85,7 @@ void Workers::start(int64_t affinity, bool nicehash)
|
|||
uv_timer_start(&m_timer, Workers::onTick, 500, 500);
|
||||
|
||||
for (int i = 0; i < threads; ++i) {
|
||||
Handle *handle = new Handle(i, threads, affinity, nicehash);
|
||||
Handle *handle = new Handle(i, threads, affinity);
|
||||
m_workers.push_back(handle);
|
||||
handle->start(Workers::onReady);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ class Workers
|
|||
public:
|
||||
static Job job();
|
||||
static void setJob(const Job &job);
|
||||
static void start(int64_t affinity, bool nicehash);
|
||||
static void start(int64_t affinity);
|
||||
static void submit(const JobResult &result);
|
||||
|
||||
static inline bool isOutdated(uint64_t sequence) { return m_sequence.load(std::memory_order_relaxed) != sequence; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue