aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_basic/miner.cpp
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2023-06-27 11:34:53 -0500
committerluigi1111 <luigi1111w@gmail.com>2023-06-27 11:34:53 -0500
commit5c900bb69fb6ca7fdfe32343a5f8aaa74d03708c (patch)
tree7acdbc583347ffbc983a5f618856a0d84fb54638 /src/cryptonote_basic/miner.cpp
parentMerge pull request #8566 (diff)
parentFixed RandomX initialization when mining from scratch (diff)
downloadmonero-5c900bb69fb6ca7fdfe32343a5f8aaa74d03708c.tar.xz
Merge pull request #8831
1d1d5fb Fixed RandomX initialization when mining from scratch (SChernykh)
Diffstat (limited to 'src/cryptonote_basic/miner.cpp')
-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 98f1555b6..71b8f78cc 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))