refactor: remove some nested code blocks

This commit is contained in:
pasta 2023-12-17 13:30:34 -06:00
parent c2ac444abf
commit ee6dc2d6ab
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -334,10 +334,7 @@ bool CQuorumBlockProcessor::UndoBlock(const CBlock& block, gsl::not_null<const C
m_evoDb.Erase(BuildInversedHeightKey(qc.llmqType, pindex->nHeight));
}
{
LOCK(minableCommitmentsCs);
mapHasMinedCommitmentCache[qc.llmqType].erase(qc.quorumHash);
}
WITH_LOCK(minableCommitmentsCs, mapHasMinedCommitmentCache[qc.llmqType].erase(qc.quorumHash));
// if a reorg happened, we should allow to mine this commitment later
AddMineableCommitment(qc);
@ -452,11 +449,8 @@ uint256 CQuorumBlockProcessor::GetQuorumBlockHash(const Consensus::LLMQParams& l
bool CQuorumBlockProcessor::HasMinedCommitment(Consensus::LLMQType llmqType, const uint256& quorumHash) const
{
bool fExists;
{
LOCK(minableCommitmentsCs);
if (mapHasMinedCommitmentCache[llmqType].get(quorumHash, fExists)) {
return fExists;
}
if (LOCK(minableCommitmentsCs); mapHasMinedCommitmentCache[llmqType].get(quorumHash, fExists)) {
return fExists;
}
fExists = m_evoDb.Exists(std::make_pair(DB_MINED_COMMITMENT, std::make_pair(llmqType, quorumHash)));