diff options
| author | Riccardo Spagni <ric@spagni.net> | 2019-04-11 13:00:55 +0200 |
|---|---|---|
| committer | Riccardo Spagni <ric@spagni.net> | 2019-04-11 13:00:55 +0200 |
| commit | 036daa3af9d7bfb288bb49196604cb532cc925df (patch) | |
| tree | 55632f5ed4b2e4793f3835a3a424f0ca07ee6db6 | |
| parent | 8e0c5b34dd7322ce4c74d95a12bd11b9b40381e3 (diff) | |
| parent | aff80e70433465a05f066e9da0e82c064f3680bb (diff) | |
| download | monzero-core-036daa3af9d7bfb288bb49196604cb532cc925df.tar.gz monzero-core-036daa3af9d7bfb288bb49196604cb532cc925df.tar.xz monzero-core-036daa3af9d7bfb288bb49196604cb532cc925df.zip | |
Merge pull request #5373
aff80e70 blockchain: fix returned height in create_block_template (moneromooo-monero)
| -rw-r--r-- | src/cryptonote_core/blockchain.cpp | 6 | ||||
| -rw-r--r-- | src/cryptonote_core/blockchain.h | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 503267a1a..393bf4340 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -1372,6 +1372,7 @@ bool Blockchain::create_block_template(block& b, const account_public_address& m m_btc.timestamp = time(NULL); // update timestamp unconditionally b = m_btc; diffic = m_btc_difficulty; + height = m_btc_height; expected_reward = m_btc_expected_reward; return true; } @@ -1516,7 +1517,7 @@ bool Blockchain::create_block_template(block& b, const account_public_address& m ", cumulative weight " << cumulative_weight << " is now good"); #endif - cache_block_template(b, miner_address, ex_nonce, diffic, expected_reward, pool_cookie); + cache_block_template(b, miner_address, ex_nonce, diffic, height, expected_reward, pool_cookie); return true; } LOG_ERROR("Failed to create_block_template with " << 10 << " tries"); @@ -4897,13 +4898,14 @@ void Blockchain::invalidate_block_template_cache() m_btc_valid = false; } -void Blockchain::cache_block_template(const block &b, const cryptonote::account_public_address &address, const blobdata &nonce, const difficulty_type &diff, uint64_t expected_reward, uint64_t pool_cookie) +void Blockchain::cache_block_template(const block &b, const cryptonote::account_public_address &address, const blobdata &nonce, const difficulty_type &diff, uint64_t height, uint64_t expected_reward, uint64_t pool_cookie) { MDEBUG("Setting block template cache"); m_btc = b; m_btc_address = address; m_btc_nonce = nonce; m_btc_difficulty = diff; + m_btc_height = height; m_btc_expected_reward = expected_reward; m_btc_pool_cookie = pool_cookie; m_btc_valid = true; diff --git a/src/cryptonote_core/blockchain.h b/src/cryptonote_core/blockchain.h index 2cd4dc31b..c1677ed37 100644 --- a/src/cryptonote_core/blockchain.h +++ b/src/cryptonote_core/blockchain.h @@ -1094,6 +1094,7 @@ namespace cryptonote account_public_address m_btc_address; blobdata m_btc_nonce; difficulty_type m_btc_difficulty; + uint64_t m_btc_height; uint64_t m_btc_pool_cookie; uint64_t m_btc_expected_reward; bool m_btc_valid; @@ -1464,6 +1465,6 @@ namespace cryptonote * * At some point, may be used to push an update to miners */ - void cache_block_template(const block &b, const cryptonote::account_public_address &address, const blobdata &nonce, const difficulty_type &diff, uint64_t expected_reward, uint64_t pool_cookie); + void cache_block_template(const block &b, const cryptonote::account_public_address &address, const blobdata &nonce, const difficulty_type &diff, uint64_t height, uint64_t expected_reward, uint64_t pool_cookie); }; } // namespace cryptonote |
