aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThaer Khawaja <thaer.khawaja@gmail.com>2018-04-15 19:02:26 -0700
committerThaer Khawaja <thaer.khawaja@gmail.com>2018-04-22 17:26:44 -0700
commitdad10775778ef5e4f7ab99d1cda653728f438540 (patch)
treee784e71564600ccd3de0789b75c5c4e6bd4062d4 /src
parentMerge pull request #3670 (diff)
downloadmonero-dad10775778ef5e4f7ab99d1cda653728f438540.tar.xz
Only log an error if fork version is higher AND is not known.
Diffstat (limited to 'src')
-rw-r--r--src/cryptonote_core/cryptonote_core.cpp5
-rw-r--r--src/cryptonote_core/cryptonote_core.h7
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler.inl2
3 files changed, 13 insertions, 1 deletions
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp
index 4d852fc99..17400ab68 100644
--- a/src/cryptonote_core/cryptonote_core.cpp
+++ b/src/cryptonote_core/cryptonote_core.cpp
@@ -1418,6 +1418,11 @@ namespace cryptonote
return true;
}
//-----------------------------------------------------------------------------------------------
+ uint8_t core::get_ideal_hard_fork_version() const
+ {
+ return get_blockchain_storage().get_ideal_hard_fork_version();
+ }
+ //-----------------------------------------------------------------------------------------------
uint8_t core::get_ideal_hard_fork_version(uint64_t height) const
{
return get_blockchain_storage().get_ideal_hard_fork_version(height);
diff --git a/src/cryptonote_core/cryptonote_core.h b/src/cryptonote_core/cryptonote_core.h
index abf79be1d..ff056c2a2 100644
--- a/src/cryptonote_core/cryptonote_core.h
+++ b/src/cryptonote_core/cryptonote_core.h
@@ -642,6 +642,13 @@ namespace cryptonote
uint64_t get_target_blockchain_height() const;
/**
+ * @brief returns the newest hardfork version known to the blockchain
+ *
+ * @return the version
+ */
+ uint8_t get_ideal_hard_fork_version() const;
+
+ /**
* @brief return the ideal hard fork version for a given block height
*
* @return what it says above
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
index 5d91ad569..78f36cc5b 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
@@ -271,7 +271,7 @@ namespace cryptonote
const uint8_t version = m_core.get_ideal_hard_fork_version(hshd.current_height - 1);
if (version >= 6 && version != hshd.top_version)
{
- if (version < hshd.top_version)
+ if (version < hshd.top_version && version == m_core.get_ideal_hard_fork_version())
MCLOG_RED(el::Level::Warning, "global", context << " peer claims higher version that we think (" <<
(unsigned)hshd.top_version << " for " << (hshd.current_height - 1) << " instead of " << (unsigned)version <<
") - we may be forked from the network and a software upgrade may be needed");