diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-08-10 10:10:04 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-08-10 11:12:56 +0100 |
commit | a1891ebea961889c2e1d1a918d84495b31ec121f (patch) | |
tree | 861119558caa3a4598e2f55850facbea75ab8625 /src | |
parent | Merge pull request #2271 (diff) | |
download | monero-a1891ebea961889c2e1d1a918d84495b31ec121f.tar.xz |
tests: fix tests build
Add get_fork_version and add_ideal_fork_version to core so
cryptonote_protocol does not have to need the Blockchain
class directly, as it's not in its dependencies, and add
those to the fake core classes in tests too.
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptonote_core/cryptonote_core.cpp | 10 | ||||
-rw-r--r-- | src/cryptonote_core/cryptonote_core.h | 14 | ||||
-rw-r--r-- | src/cryptonote_protocol/cryptonote_protocol_handler.inl | 4 |
3 files changed, 26 insertions, 2 deletions
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 13e5badd1..62c536ab8 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -1232,6 +1232,16 @@ namespace cryptonote return true; } //----------------------------------------------------------------------------------------------- + uint8_t core::get_ideal_hard_fork_version(uint64_t height) const + { + return get_blockchain_storage().get_ideal_hard_fork_version(height); + } + //----------------------------------------------------------------------------------------------- + uint8_t core::get_hard_fork_version(uint64_t height) const + { + return get_blockchain_storage().get_hard_fork_version(height); + } + //----------------------------------------------------------------------------------------------- bool core::check_updates() { static const char software[] = "monero"; diff --git a/src/cryptonote_core/cryptonote_core.h b/src/cryptonote_core/cryptonote_core.h index 171c3cb98..63d3cd16d 100644 --- a/src/cryptonote_core/cryptonote_core.h +++ b/src/cryptonote_core/cryptonote_core.h @@ -621,6 +621,20 @@ namespace cryptonote uint64_t get_target_blockchain_height() const; /** + * @brief return the ideal hard fork version for a given block height + * + * @return what it says above + */ + uint8_t get_ideal_hard_fork_version(uint64_t height) const; + + /** + * @brief return the hard fork version for a given block height + * + * @return what it says above + */ + uint8_t get_hard_fork_version(uint64_t height) const; + + /** * @brief gets start_time * */ diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl index 3e3bb83d0..cb3fc22b8 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl @@ -257,7 +257,7 @@ namespace cryptonote return true; // from v6, if the peer advertises a top block version, reject if it's not what it should be (will only work if no voting) - const uint8_t version = m_core.get_blockchain_storage().get_ideal_hard_fork_version(hshd.current_height - 1); + const uint8_t version = m_core.get_ideal_hard_fork_version(hshd.current_height - 1); if (version >= 6 && version != hshd.top_version) { LOG_DEBUG_CC(context, "Ignoring due to wrong top version (" << hshd.top_version << ", expected " << version); @@ -305,7 +305,7 @@ namespace cryptonote bool t_cryptonote_protocol_handler<t_core>::get_payload_sync_data(CORE_SYNC_DATA& hshd) { m_core.get_blockchain_top(hshd.current_height, hshd.top_id); - hshd.top_version = m_core.get_blockchain_storage().get_hard_fork_version(hshd.current_height); + hshd.top_version = m_core.get_hard_fork_version(hshd.current_height); hshd.current_height +=1; return true; } |