Skip to content

Commit

Permalink
Merge pull request #8831
Browse files Browse the repository at this point in the history
1d1d5fb Fixed RandomX initialization when mining from scratch (SChernykh)
  • Loading branch information
luigi1111 committed Jun 27, 2023
2 parents 60e9426 + 1d1d5fb commit 5c900bb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/cryptonote_basic/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 << "]");
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 5c900bb

Please sign in to comment.