P2Pool version: add patch number

This commit is contained in:
SChernykh 2024-05-28 22:41:37 +02:00
parent c96e7323cc
commit 59b693d2f3
4 changed files with 7 additions and 7 deletions

View file

@ -659,7 +659,7 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
#ifdef P2POOL_SIDECHAIN_EXTRA_1 #ifdef P2POOL_SIDECHAIN_EXTRA_1
sidechain_extra[1] = P2POOL_SIDECHAIN_EXTRA_1; sidechain_extra[1] = P2POOL_SIDECHAIN_EXTRA_1;
#else #else
sidechain_extra[1] = (P2POOL_VERSION_MAJOR << 16) | P2POOL_VERSION_MINOR; sidechain_extra[1] = P2POOL_VERSION;
#endif #endif
sidechain_extra[2] = static_cast<uint32_t>(m_rng() >> 32); sidechain_extra[2] = static_cast<uint32_t>(m_rng() >> 32);
sidechain_extra[3] = 0; sidechain_extra[3] = 0;

View file

@ -298,7 +298,7 @@ void P2PServer::update_peer_connections()
} }
if ((client->m_SoftwareID == SoftwareID::P2Pool) && client->m_SoftwareVersion && !client->m_isIncoming) { if ((client->m_SoftwareID == SoftwareID::P2Pool) && client->m_SoftwareVersion && !client->m_isIncoming) {
++total_outgoing_p2pool; ++total_outgoing_p2pool;
if (client->m_SoftwareVersion > ((P2POOL_VERSION_MAJOR << 16) | P2POOL_VERSION_MINOR)) { if (client->m_SoftwareVersion > P2POOL_VERSION) {
++newer_version_p2pool; ++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 // - use first 8 bytes of the 16-byte raw IP address to send supported protocol version and p2pool version
if (first) { if (first) {
LOGINFO(5, "sending protocol version " << (SUPPORTED_PROTOCOL_VERSION >> 16) << '.' << (SUPPORTED_PROTOCOL_VERSION & 0xFFFF) 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<char*>(m_addrString)); << " to peer " << log::Gray() << static_cast<char*>(m_addrString));
peers[0] = {}; peers[0] = {};
*reinterpret_cast<uint32_t*>(peers[0].m_addr.data) = SUPPORTED_PROTOCOL_VERSION; *reinterpret_cast<uint32_t*>(peers[0].m_addr.data) = SUPPORTED_PROTOCOL_VERSION;
*reinterpret_cast<uint32_t*>(peers[0].m_addr.data + 4) = (P2POOL_VERSION_MAJOR << 16) | P2POOL_VERSION_MINOR; *reinterpret_cast<uint32_t*>(peers[0].m_addr.data + 4) = P2POOL_VERSION;
*reinterpret_cast<uint32_t*>(peers[0].m_addr.data + 8) = static_cast<uint32_t>(SoftwareID::P2Pool); *reinterpret_cast<uint32_t*>(peers[0].m_addr.data + 8) = static_cast<uint32_t>(SoftwareID::P2Pool);
*reinterpret_cast<uint32_t*>(peers[0].m_addr.data + sizeof(raw_ip::ipv4_prefix)) = 0xFFFFFFFFU; *reinterpret_cast<uint32_t*>(peers[0].m_addr.data + sizeof(raw_ip::ipv4_prefix)) = 0xFFFFFFFFU;
peers[0].m_port = 0xFFFF; peers[0].m_port = 0xFFFF;

View file

@ -1325,8 +1325,6 @@ bool SideChain::get_difficulty(const PoolBlock* tip, std::vector<DifficultyData>
bool SideChain::p2pool_update_available() const 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; difficulty_type total_p2pool_diff, newer_p2pool_diff;
{ {
ReadLock lock(m_sidechainLock); 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)) { for (uint64_t i = 0; (i < m_chainWindowSize) && cur; ++i, cur = get_parent(cur)) {
if (cur->m_sidechainExtraBuf[0] == static_cast<uint32_t>(SoftwareID::P2Pool)) { if (cur->m_sidechainExtraBuf[0] == static_cast<uint32_t>(SoftwareID::P2Pool)) {
total_p2pool_diff += cur->m_difficulty; 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; newer_p2pool_diff += cur->m_difficulty;
} }
} }

View file

@ -38,6 +38,8 @@ namespace p2pool {
#define P2POOL_VERSION_MINOR 10 #define P2POOL_VERSION_MINOR 10
#define P2POOL_VERSION_PATCH 0 #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; extern const char* VERSION;
enum class SoftwareID : uint32_t { enum class SoftwareID : uint32_t {