refactor: adjust cs_main usage in llmq code (#4324)

This commit is contained in:
PastaPastaPasta 2021-08-10 14:37:27 -05:00 committed by GitHub
parent 6af4a22556
commit 121c838b8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 16 deletions

View File

@ -663,8 +663,8 @@ bool CSigningManager::ProcessPendingRecoveredSigs()
const auto& v = p.second;
if (batchVerifier.badSources.count(nodeId)) {
LOCK(cs_main);
LogPrint(BCLog::LLMQ, "CSigningManager::%s -- invalid recSig from other node, banning peer=%d\n", __func__, nodeId);
LOCK(cs_main);
Misbehaving(nodeId, 100);
continue;
}

View File

@ -609,24 +609,20 @@ void CSigSharesManager::CollectPendingSigSharesToVerify(
}
}
{
LOCK(cs_main);
// For the convenience of the caller, also build a map of quorumHash -> quorum
// For the convenience of the caller, also build a map of quorumHash -> quorum
for (auto& p : retSigShares) {
for (auto& sigShare : p.second) {
auto llmqType = sigShare.llmqType;
for (auto& p : retSigShares) {
for (auto& sigShare : p.second) {
auto llmqType = sigShare.llmqType;
auto k = std::make_pair(llmqType, sigShare.quorumHash);
if (retQuorums.count(k)) {
continue;
}
CQuorumCPtr quorum = quorumManager->GetQuorum(llmqType, sigShare.quorumHash);
assert(quorum != nullptr);
retQuorums.emplace(k, quorum);
auto k = std::make_pair(llmqType, sigShare.quorumHash);
if (retQuorums.count(k)) {
continue;
}
CQuorumCPtr quorum = quorumManager->GetQuorum(llmqType, sigShare.quorumHash);
assert(quorum != nullptr);
retQuorums.emplace(k, quorum);
}
}
}