diff options
author | Howard Chu <hyc@symas.com> | 2019-04-23 20:32:27 +0100 |
---|---|---|
committer | Howard Chu <hyc@symas.com> | 2019-09-25 21:29:42 +0100 |
commit | 81c2ad6d5b17cf280a4a55fd6159e8dde423f5a8 (patch) | |
tree | 7bb731b721183e73afbb60e01cf3759723e4948b /src/cryptonote_basic/miner.cpp | |
parent | Merge pull request #5909 (diff) | |
download | monero-81c2ad6d5b17cf280a4a55fd6159e8dde423f5a8.tar.xz |
RandomX integration
Support RandomX PoW algorithm
Diffstat (limited to 'src/cryptonote_basic/miner.cpp')
-rw-r--r-- | src/cryptonote_basic/miner.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/cryptonote_basic/miner.cpp b/src/cryptonote_basic/miner.cpp index 856cccdeb..0188bf114 100644 --- a/src/cryptonote_basic/miner.cpp +++ b/src/cryptonote_basic/miner.cpp @@ -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)) { |