aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_basic/miner.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2020-09-06 15:49:36 +0200
committerRiccardo Spagni <ric@spagni.net>2020-09-06 15:49:37 +0200
commitaefa7740c38754b31a4f5748569ac1af59034667 (patch)
treeffb822e7c7e0929d70b706f26f29f94caec7aecd /src/cryptonote_basic/miner.cpp
parentMerge pull request #6802 (diff)
parentfunctional_tests: add a large (many randomx epochs) p2p reorg test (diff)
downloadmonero-aefa7740c38754b31a4f5748569ac1af59034667.tar.xz
Merge pull request #6111
d20ff4f64 functional_tests: add a large (many randomx epochs) p2p reorg test (moneromooo-monero) 6a0b3b1f8 functional_tests: add randomx tests (moneromooo-monero) 9d42649d5 core: fix mining from a block that's not the current top (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_basic/miner.cpp')
-rw-r--r--src/cryptonote_basic/miner.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/cryptonote_basic/miner.cpp b/src/cryptonote_basic/miner.cpp
index 34a559b83..29f6dce5a 100644
--- a/src/cryptonote_basic/miner.cpp
+++ b/src/cryptonote_basic/miner.cpp
@@ -169,7 +169,9 @@ namespace cryptonote
extra_nonce = m_extra_messages[m_config.current_extra_message_index];
}
- if(!m_phandler->get_block_template(bl, m_mine_address, di, height, expected_reward, extra_nonce))
+ uint64_t seed_height;
+ crypto::hash seed_hash;
+ if(!m_phandler->get_block_template(bl, m_mine_address, di, height, expected_reward, extra_nonce, seed_height, seed_hash))
{
LOG_ERROR("Failed to get_block_template(), stopping mining");
return false;
@@ -471,12 +473,12 @@ namespace cryptonote
return true;
}
//-----------------------------------------------------------------------------------------------------
- bool miner::find_nonce_for_given_block(const get_block_hash_t &gbh, block& bl, const difficulty_type& diffic, uint64_t height)
+ bool miner::find_nonce_for_given_block(const get_block_hash_t &gbh, block& bl, const difficulty_type& diffic, uint64_t height, const crypto::hash *seed_hash)
{
for(; bl.nonce != std::numeric_limits<uint32_t>::max(); bl.nonce++)
{
crypto::hash h;
- gbh(bl, height, diffic <= 100 ? 0 : tools::get_max_concurrency(), h);
+ gbh(bl, height, seed_hash, diffic <= 100 ? 0 : tools::get_max_concurrency(), h);
if(check_hash(h, diffic))
{
@@ -572,7 +574,7 @@ namespace cryptonote
b.nonce = nonce;
crypto::hash h;
- m_gbh(b, height, tools::get_max_concurrency(), h);
+ m_gbh(b, height, NULL, tools::get_max_concurrency(), h);
if(check_hash(h, local_diff))
{