mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
fix: potential bug due to unspecified state of std::vector after move
This commit is contained in:
parent
8a05f0caaa
commit
83e0bb6e35
@ -520,10 +520,8 @@ void CSigningManager::CollectPendingRecoveredSigsToVerify(
|
|||||||
void CSigningManager::ProcessPendingReconstructedRecoveredSigs()
|
void CSigningManager::ProcessPendingReconstructedRecoveredSigs()
|
||||||
{
|
{
|
||||||
decltype(pendingReconstructedRecoveredSigs) m;
|
decltype(pendingReconstructedRecoveredSigs) m;
|
||||||
{
|
WITH_LOCK(cs_pending, swap(m, pendingReconstructedRecoveredSigs));
|
||||||
LOCK(cs_pending);
|
|
||||||
m = std::move(pendingReconstructedRecoveredSigs);
|
|
||||||
}
|
|
||||||
for (const auto& p : m) {
|
for (const auto& p : m) {
|
||||||
ProcessRecoveredSig(p.second);
|
ProcessRecoveredSig(p.second);
|
||||||
}
|
}
|
||||||
|
@ -1490,10 +1490,7 @@ void CSigSharesManager::AsyncSign(const CQuorumCPtr& quorum, const uint256& id,
|
|||||||
void CSigSharesManager::SignPendingSigShares()
|
void CSigSharesManager::SignPendingSigShares()
|
||||||
{
|
{
|
||||||
std::vector<PendingSignatureData> v;
|
std::vector<PendingSignatureData> v;
|
||||||
{
|
WITH_LOCK(cs_pendingSigns, v.swap(pendingSigns));
|
||||||
LOCK(cs_pendingSigns);
|
|
||||||
v = std::move(pendingSigns);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const auto& [pQuorum, id, msgHash] : v) {
|
for (const auto& [pQuorum, id, msgHash] : v) {
|
||||||
auto opt_sigShare = CreateSigShare(pQuorum, id, msgHash);
|
auto opt_sigShare = CreateSigShare(pQuorum, id, msgHash);
|
||||||
|
Loading…
Reference in New Issue
Block a user