From 66f3f4f328ba6e9d7409e1ec96b105fc5713e4bd Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Wed, 23 Jun 2021 11:07:45 +0300 Subject: [PATCH] Check for locks in more places in CSigSharesManager --- src/llmq/quorums_signing_shares.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/llmq/quorums_signing_shares.cpp b/src/llmq/quorums_signing_shares.cpp index d9c45a3114..4e7671e1ac 100644 --- a/src/llmq/quorums_signing_shares.cpp +++ b/src/llmq/quorums_signing_shares.cpp @@ -599,6 +599,7 @@ void CSigSharesManager::CollectPendingSigSharesToVerify( } auto& sigShare = *ns.pendingIncomingSigShares.GetFirst(); + AssertLockHeld(cs); bool alreadyHave = this->sigShares.Has(sigShare.GetKey()); if (!alreadyHave) { uniqueSignHashes.emplace(nodeId, sigShare.GetSignHash()); @@ -1068,6 +1069,7 @@ void CSigSharesManager::CollectSigSharesToAnnounce(std::unordered_map, std::unordered_set, StaticSaltedHasher> quorumNodesMap; sigSharesQueuedToAnnounce.ForEach([&](const SigShareKey& sigShareKey, bool) { + AssertLockHeld(cs); auto& signHash = sigShareKey.first; auto quorumMember = sigShareKey.second; const CSigShare* sigShare = sigShares.Get(sigShareKey); @@ -1428,6 +1430,7 @@ void CSigSharesManager::Cleanup() } // remove global requested state to force a re-request from another node it->second.requestedSigShares.ForEach([&](const SigShareKey& k, bool) { + AssertLockHeld(cs); sigSharesRequested.Erase(k); }); nodeStates.erase(nodeId); @@ -1462,6 +1465,7 @@ void CSigSharesManager::RemoveBannedNodeStates() if (IsBanned(it->first)) { // re-request sigshares from other nodes it->second.requestedSigShares.ForEach([&](const SigShareKey& k, int64_t) { + AssertLockHeld(cs); sigSharesRequested.Erase(k); }); it = nodeStates.erase(it); @@ -1491,6 +1495,7 @@ void CSigSharesManager::BanNode(NodeId nodeId) // Whatever we requested from him, let's request it from someone else now nodeState.requestedSigShares.ForEach([&](const SigShareKey& k, int64_t) { + AssertLockHeld(cs); sigSharesRequested.Erase(k); }); nodeState.requestedSigShares.Clear();