diff --git a/src/core/Miner.cpp b/src/core/Miner.cpp index 1f99b943f..e84fea374 100644 --- a/src/core/Miner.cpp +++ b/src/core/Miner.cpp @@ -59,6 +59,7 @@ # include "crypto/rx/Profiler.h" # include "crypto/rx/Rx.h" # include "crypto/rx/RxConfig.h" +# include "crypto/rx/RxAlgo.h" #endif @@ -556,11 +557,12 @@ void xmrig::Miner::setJob(const Job &job, bool donate) } # ifdef XMRIG_ALGO_RANDOMX - if (job.algorithm().family() == Algorithm::RANDOM_X && !Rx::isReady(job)) { + if (job.algorithm().family() == Algorithm::RANDOM_X) { if (d_ptr->algorithm != job.algorithm()) { stop(); + RxAlgo::apply(job.algorithm()); } - else { + else if (!Rx::isReady(job)) { Nonce::pause(true); Nonce::touch(); } diff --git a/src/crypto/rx/RxSeed.h b/src/crypto/rx/RxSeed.h index f30fbfb72..45f1a288a 100644 --- a/src/crypto/rx/RxSeed.h +++ b/src/crypto/rx/RxSeed.h @@ -47,8 +47,8 @@ public: inline RxSeed(const Algorithm &algorithm, const Buffer &seed) : m_algorithm(algorithm), m_data(seed) {} inline RxSeed(const Job &job) : m_algorithm(job.algorithm()), m_data(job.seed()) {} - inline bool isEqual(const Job &job) const { return m_algorithm == job.algorithm() && m_data == job.seed(); } - inline bool isEqual(const RxSeed &other) const { return m_algorithm == other.m_algorithm && m_data == other.m_data; } + inline bool isEqual(const Job &job) const { return isEqualSeedAlgo(job.algorithm()) && m_data == job.seed(); } + inline bool isEqual(const RxSeed &other) const { return isEqualSeedAlgo(other.m_algorithm) && m_data == other.m_data; } inline const Algorithm &algorithm() const { return m_algorithm; } inline const Buffer &data() const { return m_data; } @@ -60,6 +60,12 @@ public: private: Algorithm m_algorithm; Buffer m_data; + + inline bool isEqualSeedAlgo(Algorithm other) const { + return (m_algorithm == other) || + ((m_algorithm == Algorithm::RX_0) && (other == Algorithm::RX_V2)) || + ((m_algorithm == Algorithm::RX_V2) && (other == Algorithm::RX_0)); + } };