P2Pool version: add patch number

merge-mining
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
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<uint32_t>(m_rng() >> 32);
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) {
++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<char*>(m_addrString));
peers[0] = {};
*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 + sizeof(raw_ip::ipv4_prefix)) = 0xFFFFFFFFU;
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
{
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<uint32_t>(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;
}
}

View File

@ -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 {