Skip to content

Commit 149e3e3

Browse files
UdjinM6panleone
authored andcommitted
Various small cleanups (#2761)
* use AssertLockHeld(cs) instead of relying on comments * actually use `clsig` in `EnforceBestChainLock()` * fix log output in `EnforceBestChainLock()` * drop comments
1 parent cc7450d commit 149e3e3

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/llmq/quorums_chainlocks.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ void CChainLocksHandler::EnforceBestChainLock()
262262
continue;
263263
}
264264
LogPrintf("CChainLocksHandler::%s -- CLSIG (%s) invalidates block %s\n",
265-
__func__, bestChainLockWithKnownBlock.ToString(), jt->second->GetBlockHash().ToString());
265+
__func__, clsig.ToString(), jt->second->GetBlockHash().ToString());
266266
DoInvalidateBlock(jt->second, false);
267267
}
268268

@@ -273,7 +273,7 @@ void CChainLocksHandler::EnforceBestChainLock()
273273

274274
CValidationState state;
275275
if (!ActivateBestChain(state)) {
276-
LogPrintf("CChainLocksHandler::UpdatedBlockTip -- ActivateBestChain failed: %s\n", state.GetRejectReason());
276+
LogPrintf("CChainLocksHandler::%s -- ActivateBestChain failed: %s\n", __func__, state.GetRejectReason());
277277
// This should not have happened and we are in a state were it's not safe to continue anymore
278278
assert(false);
279279
}

src/llmq/quorums_signing_shares.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -781,9 +781,10 @@ void CSigSharesManager::TryRecoverSig(const CQuorumCPtr& quorum, const uint256&
781781
quorumSigningManager->ProcessRecoveredSig(-1, rs, quorum, connman);
782782
}
783783

784-
// cs must be held
785784
void CSigSharesManager::CollectSigSharesToRequest(std::unordered_map<NodeId, std::unordered_map<uint256, CSigSharesInv, StaticSaltedHasher>>& sigSharesToRequest)
786785
{
786+
AssertLockHeld(cs);
787+
787788
int64_t now = GetTimeMillis();
788789
const size_t maxRequestsForNode = 32;
789790

@@ -876,9 +877,10 @@ void CSigSharesManager::CollectSigSharesToRequest(std::unordered_map<NodeId, std
876877
}
877878
}
878879

879-
// cs must be held
880880
void CSigSharesManager::CollectSigSharesToSend(std::unordered_map<NodeId, std::unordered_map<uint256, CBatchedSigShares, StaticSaltedHasher>>& sigSharesToSend)
881881
{
882+
AssertLockHeld(cs);
883+
882884
for (auto& p : nodeStates) {
883885
auto nodeId = p.first;
884886
auto& nodeState = p.second;
@@ -927,9 +929,10 @@ void CSigSharesManager::CollectSigSharesToSend(std::unordered_map<NodeId, std::u
927929
}
928930
}
929931

930-
// cs must be held
931932
void CSigSharesManager::CollectSigSharesToAnnounce(std::unordered_map<NodeId, std::unordered_map<uint256, CSigSharesInv, StaticSaltedHasher>>& sigSharesToAnnounce)
932933
{
934+
AssertLockHeld(cs);
935+
933936
std::unordered_set<std::pair<Consensus::LLMQType, uint256>, StaticSaltedHasher> quorumNodesPrepared;
934937

935938
this->sigSharesToAnnounce.ForEach([&](const SigShareKey& sigShareKey, bool) {

0 commit comments

Comments
 (0)