diff --git a/src/block_template.cpp b/src/block_template.cpp index fd98126..2c99941 100644 --- a/src/block_template.cpp +++ b/src/block_template.cpp @@ -659,7 +659,7 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const #ifdef P2POOL_SIDECHAIN_EXTRA_1 sidechain_extra[1] = P2POOL_SIDECHAIN_EXTRA_1; #else - sidechain_extra[1] = (P2POOL_VERSION_MAJOR << 16) | P2POOL_VERSION_MINOR; + sidechain_extra[1] = P2POOL_VERSION; #endif sidechain_extra[2] = static_cast(m_rng() >> 32); sidechain_extra[3] = 0; diff --git a/src/p2p_server.cpp b/src/p2p_server.cpp index bf6d9be..02484d8 100644 --- a/src/p2p_server.cpp +++ b/src/p2p_server.cpp @@ -298,7 +298,7 @@ void P2PServer::update_peer_connections() } if ((client->m_SoftwareID == SoftwareID::P2Pool) && client->m_SoftwareVersion && !client->m_isIncoming) { ++total_outgoing_p2pool; - if (client->m_SoftwareVersion > ((P2POOL_VERSION_MAJOR << 16) | P2POOL_VERSION_MINOR)) { + if (client->m_SoftwareVersion > P2POOL_VERSION) { ++newer_version_p2pool; } } @@ -2319,12 +2319,12 @@ bool P2PServer::P2PClient::on_peer_list_request(const uint8_t*) // - use first 8 bytes of the 16-byte raw IP address to send supported protocol version and p2pool version if (first) { LOGINFO(5, "sending protocol version " << (SUPPORTED_PROTOCOL_VERSION >> 16) << '.' << (SUPPORTED_PROTOCOL_VERSION & 0xFFFF) - << ", P2Pool version " << P2POOL_VERSION_MAJOR << '.' << P2POOL_VERSION_MINOR + << ", P2Pool version " << P2POOL_VERSION_MAJOR << '.' << P2POOL_VERSION_MINOR << '.' << P2POOL_VERSION_PATCH << " to peer " << log::Gray() << static_cast(m_addrString)); peers[0] = {}; *reinterpret_cast(peers[0].m_addr.data) = SUPPORTED_PROTOCOL_VERSION; - *reinterpret_cast(peers[0].m_addr.data + 4) = (P2POOL_VERSION_MAJOR << 16) | P2POOL_VERSION_MINOR; + *reinterpret_cast(peers[0].m_addr.data + 4) = P2POOL_VERSION; *reinterpret_cast(peers[0].m_addr.data + 8) = static_cast(SoftwareID::P2Pool); *reinterpret_cast(peers[0].m_addr.data + sizeof(raw_ip::ipv4_prefix)) = 0xFFFFFFFFU; peers[0].m_port = 0xFFFF; diff --git a/src/side_chain.cpp b/src/side_chain.cpp index cc6be83..1c41c4e 100644 --- a/src/side_chain.cpp +++ b/src/side_chain.cpp @@ -1325,8 +1325,6 @@ bool SideChain::get_difficulty(const PoolBlock* tip, std::vector bool SideChain::p2pool_update_available() const { - constexpr uint32_t version = (P2POOL_VERSION_MAJOR << 16) | P2POOL_VERSION_MINOR; - difficulty_type total_p2pool_diff, newer_p2pool_diff; { ReadLock lock(m_sidechainLock); @@ -1336,7 +1334,7 @@ bool SideChain::p2pool_update_available() const for (uint64_t i = 0; (i < m_chainWindowSize) && cur; ++i, cur = get_parent(cur)) { if (cur->m_sidechainExtraBuf[0] == static_cast(SoftwareID::P2Pool)) { total_p2pool_diff += cur->m_difficulty; - if (cur->m_sidechainExtraBuf[1] > version) { + if (cur->m_sidechainExtraBuf[1] > P2POOL_VERSION) { newer_p2pool_diff += cur->m_difficulty; } } diff --git a/src/util.h b/src/util.h index 9636e9d..4ce5c64 100644 --- a/src/util.h +++ b/src/util.h @@ -38,6 +38,8 @@ namespace p2pool { #define P2POOL_VERSION_MINOR 10 #define P2POOL_VERSION_PATCH 0 +constexpr uint32_t P2POOL_VERSION = (P2POOL_VERSION_MAJOR << 16) | (P2POOL_VERSION_MINOR << 8) | P2POOL_VERSION_PATCH; + extern const char* VERSION; enum class SoftwareID : uint32_t {