diff --git a/src/llmq/signing.cpp b/src/llmq/signing.cpp index 9aa5a72ec8..edc8e2f74a 100644 --- a/src/llmq/signing.cpp +++ b/src/llmq/signing.cpp @@ -520,10 +520,8 @@ void CSigningManager::CollectPendingRecoveredSigsToVerify( void CSigningManager::ProcessPendingReconstructedRecoveredSigs() { decltype(pendingReconstructedRecoveredSigs) m; - { - LOCK(cs_pending); - m = std::move(pendingReconstructedRecoveredSigs); - } + WITH_LOCK(cs_pending, swap(m, pendingReconstructedRecoveredSigs)); + for (const auto& p : m) { ProcessRecoveredSig(p.second); } diff --git a/src/llmq/signing_shares.cpp b/src/llmq/signing_shares.cpp index 3f522a121b..6cfb8d1655 100644 --- a/src/llmq/signing_shares.cpp +++ b/src/llmq/signing_shares.cpp @@ -1490,10 +1490,7 @@ void CSigSharesManager::AsyncSign(const CQuorumCPtr& quorum, const uint256& id, void CSigSharesManager::SignPendingSigShares() { std::vector v; - { - LOCK(cs_pendingSigns); - v = std::move(pendingSigns); - } + WITH_LOCK(cs_pendingSigns, v.swap(pendingSigns)); for (const auto& [pQuorum, id, msgHash] : v) { auto opt_sigShare = CreateSigShare(pQuorum, id, msgHash); diff --git a/src/masternode/meta.cpp b/src/masternode/meta.cpp index c8499c5cb6..4c2ef7889c 100644 --- a/src/masternode/meta.cpp +++ b/src/masternode/meta.cpp @@ -122,9 +122,8 @@ void CMasternodeMetaMan::RemoveGovernanceObject(const uint256& nGovernanceObject std::vector CMasternodeMetaMan::GetAndClearDirtyGovernanceObjectHashes() { - LOCK(cs); - std::vector vecTmp = std::move(vecDirtyGovernanceObjectHashes); - vecDirtyGovernanceObjectHashes.clear(); + std::vector vecTmp; + WITH_LOCK(cs, vecTmp.swap(vecDirtyGovernanceObjectHashes)); return vecTmp; }