From d557fe7f39a538dfa4e08ff3f1c05b0fe8005988 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Sun, 29 Nov 2020 22:02:48 +0100 Subject: [PATCH] Fix RandomX init when switching to other algo and back --- src/crypto/rx/Rx.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/crypto/rx/Rx.cpp b/src/crypto/rx/Rx.cpp index 01a00214..2fffb0e6 100644 --- a/src/crypto/rx/Rx.cpp +++ b/src/crypto/rx/Rx.cpp @@ -104,10 +104,6 @@ bool xmrig::Rx::init(const T &seed, const RxConfig &config, const CpuConfig &cpu randomx_set_scratchpad_prefetch_mode(config.scratchpadPrefetchMode()); randomx_set_huge_pages_jit(cpu.isHugePagesJit()); - if (isReady(seed)) { - return true; - } - if (!msrInitialized) { msrEnabled = msrInit(config, cpu.threads().get(seed.algorithm()).data()); msrInitialized = true; @@ -121,6 +117,10 @@ bool xmrig::Rx::init(const T &seed, const RxConfig &config, const CpuConfig &cpu osInitialized = true; } + if (isReady(seed)) { + return true; + } + d_ptr->queue.enqueue(seed, config.nodeset(), config.threads(cpu.limit()), cpu.isHugePages(), config.isOneGbPages(), config.mode(), cpu.priority()); return false;