mirror of
https://github.com/monero-project/monero.git
synced 2025-05-04 06:54:56 -04:00
Refactored rx-slow-hash.c
- Straight-forward call interface: `void rx_slow_hash(const char *seedhash, const void *data, size_t length, char *result_hash)` - Consensus chain seed hash is now updated by calling `rx_set_main_seedhash` whenever a block is added/removed or a reorg happens - `rx_slow_hash` will compute correct hash no matter if `rx_set_main_seedhash` was called or not (the only difference is performance) - New environment variable `MONERO_RANDOMX_FULL_MEM` to force use the full dataset for PoW verification (faster block verification) - When dataset is used for PoW verification, dataset updates don't stall other threads (verification is done in light mode then) - When mining is running, PoW checks now also use dataset for faster verification
This commit is contained in:
parent
8cb10345d6
commit
f698f2b708
11 changed files with 398 additions and 253 deletions
|
@ -82,6 +82,7 @@
|
|||
using namespace epee;
|
||||
|
||||
#include "miner.h"
|
||||
#include "crypto/hash.h"
|
||||
|
||||
|
||||
extern "C" void slow_hash_allocate_state();
|
||||
|
@ -436,7 +437,6 @@ namespace cryptonote
|
|||
{
|
||||
m_stop = true;
|
||||
}
|
||||
extern "C" void rx_stop_mining(void);
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
bool miner::stop()
|
||||
{
|
||||
|
@ -469,7 +469,6 @@ namespace cryptonote
|
|||
MINFO("Mining has been stopped, " << m_threads.size() << " finished" );
|
||||
m_threads.clear();
|
||||
m_threads_autodetect.clear();
|
||||
rx_stop_mining();
|
||||
return true;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
|
@ -524,6 +523,8 @@ 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());
|
||||
|
||||
MLOG_SET_THREAD_NAME(std::string("[miner ") + std::to_string(th_local_index) + "]");
|
||||
MGINFO("Miner thread was started ["<< th_local_index << "]");
|
||||
uint32_t nonce = m_starter_nonce + th_local_index;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue