aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_basic
diff options
context:
space:
mode:
authorSChernykh <sergey.v.chernykh@gmail.com>2023-04-27 16:24:15 +0200
committerSChernykh <sergey.v.chernykh@gmail.com>2023-04-27 16:31:21 +0200
commit092e964a8763bd25a86837cd1f0719da21e10f41 (patch)
treed8624690c7061b5d60cdb7b5d6b3d034fbb5ba1b /src/cryptonote_basic
parentMerge pull request #8760 (diff)
downloadmonero-092e964a8763bd25a86837cd1f0719da21e10f41.tar.xz
Fixed RandomX initialization when mining from scratch
Diffstat (limited to 'src/cryptonote_basic')
-rw-r--r--src/cryptonote_basic/miner.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/cryptonote_basic/miner.cpp b/src/cryptonote_basic/miner.cpp
index 249896ee8..91ee86d60 100644
--- a/src/cryptonote_basic/miner.cpp
+++ b/src/cryptonote_basic/miner.cpp
@@ -523,7 +523,7 @@ namespace cryptonote
bool miner::worker_thread()
{
const uint32_t th_local_index = m_thread_index++; // atomically increment, getting value before increment
- crypto::rx_set_miner_thread(th_local_index, tools::get_max_concurrency());
+ bool rx_set = false;
MLOG_SET_THREAD_NAME(std::string("[miner ") + std::to_string(th_local_index) + "]");
MGINFO("Miner thread was started ["<< th_local_index << "]");
@@ -575,6 +575,13 @@ namespace cryptonote
b.nonce = nonce;
crypto::hash h;
+
+ if ((b.major_version >= RX_BLOCK_VERSION) && !rx_set)
+ {
+ crypto::rx_set_miner_thread(th_local_index, tools::get_max_concurrency());
+ rx_set = true;
+ }
+
m_gbh(b, height, NULL, tools::get_max_concurrency(), h);
if(check_hash(h, local_diff))