1
0
mirror of https://github.com/xmrig/xmrig.git synced 2026-04-17 04:59:28 -04:00

RandomX v2: don't update dataset when switching to/from it

This commit is contained in:
SChernykh
2026-02-13 13:32:25 +01:00
parent 26ee1cd291
commit 48b29fd68b
2 changed files with 12 additions and 4 deletions

View File

@@ -59,6 +59,7 @@
# include "crypto/rx/Profiler.h" # include "crypto/rx/Profiler.h"
# include "crypto/rx/Rx.h" # include "crypto/rx/Rx.h"
# include "crypto/rx/RxConfig.h" # include "crypto/rx/RxConfig.h"
# include "crypto/rx/RxAlgo.h"
#endif #endif
@@ -556,11 +557,12 @@ void xmrig::Miner::setJob(const Job &job, bool donate)
} }
# ifdef XMRIG_ALGO_RANDOMX # 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()) { if (d_ptr->algorithm != job.algorithm()) {
stop(); stop();
RxAlgo::apply(job.algorithm());
} }
else { else if (!Rx::isReady(job)) {
Nonce::pause(true); Nonce::pause(true);
Nonce::touch(); Nonce::touch();
} }

View File

@@ -47,8 +47,8 @@ public:
inline RxSeed(const Algorithm &algorithm, const Buffer &seed) : m_algorithm(algorithm), m_data(seed) {} 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 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 Job &job) const { return isEqualSeedAlgo(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 RxSeed &other) const { return isEqualSeedAlgo(other.m_algorithm) && m_data == other.m_data; }
inline const Algorithm &algorithm() const { return m_algorithm; } inline const Algorithm &algorithm() const { return m_algorithm; }
inline const Buffer &data() const { return m_data; } inline const Buffer &data() const { return m_data; }
@@ -60,6 +60,12 @@ public:
private: private:
Algorithm m_algorithm; Algorithm m_algorithm;
Buffer m_data; 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));
}
}; };