refactor: use swap instead assign+clean in GetAndClearDirtyGovernanceObjectHashes

This commit is contained in:
Konstantin Akimov 2024-11-27 01:13:43 +07:00
parent 83e0bb6e35
commit 6f75a7f601
No known key found for this signature in database
GPG Key ID: 2176C4A5D01EA524

View File

@ -122,9 +122,8 @@ void CMasternodeMetaMan::RemoveGovernanceObject(const uint256& nGovernanceObject
std::vector<uint256> CMasternodeMetaMan::GetAndClearDirtyGovernanceObjectHashes() std::vector<uint256> CMasternodeMetaMan::GetAndClearDirtyGovernanceObjectHashes()
{ {
LOCK(cs); std::vector<uint256> vecTmp;
std::vector<uint256> vecTmp = std::move(vecDirtyGovernanceObjectHashes); WITH_LOCK(cs, vecTmp.swap(vecDirtyGovernanceObjectHashes));
vecDirtyGovernanceObjectHashes.clear();
return vecTmp; return vecTmp;
} }