mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-22 22:08:54 +00:00
cryptonote_protocol: print peer versions when unexpected
also avoid integer underflow on zero height
This commit is contained in:
parent
490a5d41ca
commit
25584f8639
@ -266,14 +266,18 @@ namespace cryptonote
|
|||||||
return true;
|
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)
|
// 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)
|
||||||
|
if (hshd.current_height > 0)
|
||||||
|
{
|
||||||
const uint8_t version = m_core.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)
|
if (version >= 6 && version != hshd.top_version)
|
||||||
{
|
{
|
||||||
if (version < hshd.top_version)
|
if (version < hshd.top_version)
|
||||||
MCLOG_RED(el::Level::Warning, "global", context << " peer claims higher version that we think - we may be forked from the network and a software upgrade may be needed");
|
MCLOG_RED(el::Level::Warning, "global", context << " peer claims higher version that we think (" <<
|
||||||
LOG_DEBUG_CC(context, "Ignoring due to wrong top version for block " << (hshd.current_height - 1) << ": " << (unsigned)hshd.top_version << ", expected " << (unsigned)version);
|
(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");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
context.m_remote_blockchain_height = hshd.current_height;
|
context.m_remote_blockchain_height = hshd.current_height;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user