Skip to content

Commit

Permalink
trivial: use WITH_LOCK when possible (dashpay#5879)
Browse files Browse the repository at this point in the history
  • Loading branch information
PastaPastaPasta authored Feb 16, 2024
1 parent c5fcab9 commit 3be3c1d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/llmq/ehf_signals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ void CEHFSignalsHandler::trySignEHFSignal(int bit, const CBlockIndex* const pind
return;
}
if (sigman.HasRecoveredSigForId(llmqType, requestId)) {
LOCK(cs);
ids.insert(requestId);
WITH_LOCK(cs, ids.insert(requestId));

LogPrint(BCLog::EHF, "CEHFSignalsHandler::trySignEHFSignal: already signed bit=%d at height=%d id=%s\n", bit, pindex->nHeight, requestId.ToString());
// no need to sign same message one more time
Expand All @@ -88,10 +87,7 @@ void CEHFSignalsHandler::trySignEHFSignal(int bit, const CBlockIndex* const pind
mnhfPayload.signal.quorumHash = quorum->qc->quorumHash;
const uint256 msgHash = mnhfPayload.PrepareTx().GetHash();

{
LOCK(cs);
ids.insert(requestId);
}
WITH_LOCK(cs, ids.insert(requestId));
sigman.AsyncSignIfMember(llmqType, shareman, requestId, msgHash);
}

Expand Down

0 comments on commit 3be3c1d

Please sign in to comment.