From 5e524df7adeed48c798f51097b85704439a0420f Mon Sep 17 00:00:00 2001 From: pasta Date: Thu, 12 Nov 2026 23:48:51 -0600 Subject: [PATCH 1/3] fix(llmq): initialize the watch-connection seed with a function-local static Two first callers of CalcDeterministicWatchConnections could both see the generated flag unset, and one could regenerate the seed while the other was already reading it. Co-Authored-By: Claude Fable 5.2 --- src/llmq/utils.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/llmq/utils.cpp b/src/llmq/utils.cpp index 541de71ed982..a27c86d9b64f 100644 --- a/src/llmq/utils.cpp +++ b/src/llmq/utils.cpp @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -902,14 +901,7 @@ std::unordered_set CalcDeterministicWatchConnections(Consensus::LLMQType gsl::not_null pQuorumBaseBlockIndex, size_t memberCount, size_t connectionCount) { - static uint256 qwatchConnectionSeed; - static std::atomic qwatchConnectionSeedGenerated{false}; - static RecursiveMutex qwatchConnectionSeedCs; - if (!qwatchConnectionSeedGenerated) { - LOCK(qwatchConnectionSeedCs); - qwatchConnectionSeed = GetRandHash(); - qwatchConnectionSeedGenerated = true; - } + static const uint256 qwatchConnectionSeed = GetRandHash(); std::unordered_set result; uint256 rnd = qwatchConnectionSeed; From 547392c6aa327383e2bfc0ad8fafcb27601bd8fc Mon Sep 17 00:00:00 2001 From: pasta Date: Thu, 12 Nov 2026 23:48:51 -0600 Subject: [PATCH 2/3] fix(llmq): drop the whole sig-share batch when a quorum lookup fails CollectPendingSigSharesToVerify returned with the shares collected so far but without their quorums. The caller dispatches whenever the share map is non-empty, so verification then hit quorums.at() for a missing key. Co-Authored-By: Claude Fable 5.2 --- src/llmq/signing_shares.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/llmq/signing_shares.cpp b/src/llmq/signing_shares.cpp index d1998ffced08..a1af7093be9b 100644 --- a/src/llmq/signing_shares.cpp +++ b/src/llmq/signing_shares.cpp @@ -596,6 +596,8 @@ bool CSigSharesManager::CollectPendingSigSharesToVerify( if (!quorum) { LogPrintf("%s: ERROR! Unexpected missing quorum with llmqType=%d, quorumHash=%s\n", __func__, std23::to_underlying(llmqType), sigShare.getQuorumHash().ToString()); + retSigShares.clear(); + retQuorums.clear(); return false; } retQuorums.try_emplace(k, quorum); From 9707616dad9bca31df444646d3bc0f53966a4373 Mon Sep 17 00:00:00 2001 From: pasta Date: Thu, 12 Nov 2026 23:48:51 -0600 Subject: [PATCH 3/3] fix(chainlock): join the scheduler thread in ChainlockHandler::Stop() Stop() only asked the scheduler to stop, and the thread was joined in the destructor at NodeContext destruction. A task already running could keep going through the rest of shutdown, after mn_sync and the mempool were destroyed, or block in ActivateBestChain on the validation queue of the already stopped main scheduler. Co-Authored-By: Claude Fable 5.2 --- src/chainlock/handler.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/chainlock/handler.cpp b/src/chainlock/handler.cpp index 69f2efb47067..cadce2a74dc8 100644 --- a/src/chainlock/handler.cpp +++ b/src/chainlock/handler.cpp @@ -57,8 +57,7 @@ ChainlockHandler::ChainlockHandler(chainlock::Chainlocks& chainlocks, Chainstate ChainlockHandler::~ChainlockHandler() { - scheduler->stop(); - scheduler_thread->join(); + Stop(); } void ChainlockHandler::Start() @@ -72,7 +71,13 @@ void ChainlockHandler::Start() std::chrono::seconds{5}); } -void ChainlockHandler::Stop() { scheduler->stop(); } +void ChainlockHandler::Stop() +{ + scheduler->stop(); + if (scheduler_thread->joinable()) { + scheduler_thread->join(); + } +} bool ChainlockHandler::AlreadyHave(const CInv& inv) const {