From 0f25fe0433816683b2e438f73d19fa1a0bd47463 Mon Sep 17 00:00:00 2001 From: CodeIsTheKey Date: Fri, 19 Apr 2024 20:17:13 -0600 Subject: [PATCH] Unknown Updates Check (#372) * Fixed unknown rules check. Minor typo cleanup. * Removed debugging work. * debug cleanup --- src/llmq/quorums_parameters.h | 2 +- src/net.cpp | 2 +- src/validation.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/llmq/quorums_parameters.h b/src/llmq/quorums_parameters.h index df4d38e79..923a65ed5 100644 --- a/src/llmq/quorums_parameters.h +++ b/src/llmq/quorums_parameters.h @@ -17,7 +17,7 @@ namespace Consensus { LLMQ_NONE = 0xFF, LLMQ_INVALID = 0x00, // Do not use - flag to indicate new serialization LLMQ_50_60 = 1, // 50 members, 30 (60%) threshold, one per hour - LLMQ_400_60 = 2, // 400 members, 240 (60%) threshols, one every 12 hours + LLMQ_400_60 = 2, // 400 members, 240 (60%) threshold, one every 12 hours LLMQ_400_85 = 3, // 400 members, 340 (85%) threshold, one every 24 hours LLMQ_100_67 = 4, // 100 members, 67 (67%) threshold, one per hour diff --git a/src/net.cpp b/src/net.cpp index 0c46670f4..0f5fecc00 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1863,7 +1863,7 @@ void CConnman::ThreadSocketHandler() { int64_t nLastCleanupNodes = 0; while (!interruptNet) { - // Handle sockets before we do the next rounf of disconnects. This allows us to flush send buffers one last time + // Handle sockets before we do the next round of disconnects. This allows us to flush send buffers one last time // before actually closing sockets. Receiving is however skipped in case a peer is pending to be disconnected SocketHandler(); if (GetTimeMillis() - nLastCleanupNodes > 1000) { diff --git a/src/validation.cpp b/src/validation.cpp index 082af0a8c..e0bf492b8 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2843,7 +2843,7 @@ EXCLUSIVE_LOCKS_REQUIRED(::cs_main) const CBlockIndex *pindex = pindexNew; uint32_t nExpectedVersion = Updates().ComputeBlockVersion(pindex); - if (pindexNew->nVersion != nExpectedVersion) { + if ((pindexNew->nVersion | nExpectedVersion) != nExpectedVersion) { const std::string strWarning = strprintf(_("Warning: unknown new rules activated: Expected: 0x%08x, Actual: 0x%08x"), nExpectedVersion, pindexNew->nVersion); AppendWarning(warningMessages, strWarning); } @@ -2852,7 +2852,7 @@ EXCLUSIVE_LOCKS_REQUIRED(::cs_main) for (int i = 0; i < 100 && pindex != nullptr; i++) { nExpectedVersion = Updates().ComputeBlockVersion(pindex->pprev); if (pindex->nVersion > VERSIONBITS_LAST_OLD_BLOCK_VERSION && - (pindex->nVersion & ~nExpectedVersion) != 0) + (pindex->nVersion | nExpectedVersion) != nExpectedVersion) ++nUpgraded; pindex = pindex->pprev; }