mirror of
https://github.com/monero-project/monero.git
synced 2025-05-10 21:54:59 -04:00
RandomX integration
Support RandomX PoW algorithm
This commit is contained in:
parent
cb6f96b9d1
commit
81c2ad6d5b
24 changed files with 610 additions and 49 deletions
|
@ -36,8 +36,10 @@
|
|||
#include "syncobj.h"
|
||||
#include "cryptonote_basic_impl.h"
|
||||
#include "cryptonote_format_utils.h"
|
||||
#include "cryptonote_core/cryptonote_tx_utils.h"
|
||||
#include "file_io_utils.h"
|
||||
#include "common/command_line.h"
|
||||
#include "common/util.h"
|
||||
#include "string_coding.h"
|
||||
#include "string_tools.h"
|
||||
#include "storages/portable_storage_template_helper.h"
|
||||
|
@ -98,12 +100,13 @@ namespace cryptonote
|
|||
}
|
||||
|
||||
|
||||
miner::miner(i_miner_handler* phandler):m_stop(1),
|
||||
miner::miner(i_miner_handler* phandler, Blockchain* pbc):m_stop(1),
|
||||
m_template{},
|
||||
m_template_no(0),
|
||||
m_diffic(0),
|
||||
m_thread_index(0),
|
||||
m_phandler(phandler),
|
||||
m_pbc(pbc),
|
||||
m_height(0),
|
||||
m_threads_active(0),
|
||||
m_pausers_count(0),
|
||||
|
@ -429,6 +432,7 @@ namespace cryptonote
|
|||
{
|
||||
boost::interprocess::ipcdetail::atomic_write32(&m_stop, 1);
|
||||
}
|
||||
extern "C" void rx_stop_mining(void);
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
bool miner::stop()
|
||||
{
|
||||
|
@ -461,15 +465,16 @@ namespace cryptonote
|
|||
MINFO("Mining has been stopped, " << m_threads.size() << " finished" );
|
||||
m_threads.clear();
|
||||
m_threads_autodetect.clear();
|
||||
rx_stop_mining();
|
||||
return true;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
bool miner::find_nonce_for_given_block(block& bl, const difficulty_type& diffic, uint64_t height)
|
||||
bool miner::find_nonce_for_given_block(const Blockchain *pbc, block& bl, const difficulty_type& diffic, uint64_t height)
|
||||
{
|
||||
for(; bl.nonce != std::numeric_limits<uint32_t>::max(); bl.nonce++)
|
||||
{
|
||||
crypto::hash h;
|
||||
get_block_longhash(bl, h, height);
|
||||
get_block_longhash(pbc, bl, h, height, tools::get_max_concurrency());
|
||||
|
||||
if(check_hash(h, diffic))
|
||||
{
|
||||
|
@ -565,7 +570,7 @@ namespace cryptonote
|
|||
|
||||
b.nonce = nonce;
|
||||
crypto::hash h;
|
||||
get_block_longhash(b, h, height);
|
||||
get_block_longhash(m_pbc, b, h, height, tools::get_max_concurrency());
|
||||
|
||||
if(check_hash(h, local_diff))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue