This commit is contained in:
MoneroOcean 2020-03-06 08:50:55 -08:00
commit f9287c2e14
43 changed files with 695 additions and 324 deletions

View file

@ -32,6 +32,7 @@
#include "core/Miner.h"
#include "crypto/cn/CnCtx.h"
#include "crypto/cn/CryptoNight_test.h"
#include "crypto/cn/CryptoNight.h"
#include "crypto/common/Nonce.h"
#include "crypto/common/VirtualMemory.h"
#include "crypto/rx/Rx.h"
@ -80,6 +81,7 @@ xmrig::CpuWorker<N>::CpuWorker(size_t id, const CpuLaunchData &data) :
m_hwAES(data.hwAES),
m_yield(data.yield),
m_av(data.av()),
m_astrobwtMaxSize(data.astrobwtMaxSize * 1000),
m_miner(data.miner),
m_ctx()
{
@ -241,6 +243,8 @@ void xmrig::CpuWorker<N>::start()
current_job_nonces[i] = *m_job.nonce(i);
}
bool valid = true;
# ifdef XMRIG_ALGO_RANDOMX
if (job.algorithm().family() == Algorithm::RANDOM_X) {
if (job.algorithm() == Algorithm::DEFYX) {
@ -267,20 +271,31 @@ void xmrig::CpuWorker<N>::start()
else
# endif
{
fn(job.algorithm())(m_job.blob(), job.size(), m_hash, m_ctx, job.height());
# ifdef XMRIG_ALGO_ASTROBWT
if (job.algorithm().family() == Algorithm::ASTROBWT) {
if (!astrobwt::astrobwt_dero(m_job.blob(), job.size(), m_ctx[0]->memory, m_hash, m_astrobwtMaxSize))
valid = false;
}
else
# endif
{
fn(job.algorithm())(m_job.blob(), job.size(), m_hash, m_ctx, job.height());
}
if (!nextRound(m_job)) {
break;
};
}
for (size_t i = 0; i < N; ++i) {
if (*reinterpret_cast<uint64_t*>(m_hash + (i * 32) + 24) < job.target()) {
JobResults::submit(job, current_job_nonces[i], m_hash + (i * 32));
if (valid) {
for (size_t i = 0; i < N; ++i) {
if (*reinterpret_cast<uint64_t*>(m_hash + (i * 32) + 24) < job.target()) {
JobResults::submit(job, current_job_nonces[i], m_hash + (i * 32));
}
}
m_count += N;
}
m_count += N;
if (m_yield) {
std::this_thread::yield();
}