refactor: introduce cs_pendingSigns

This commit is contained in:
pasta 2024-11-20 13:54:33 -06:00
parent 5adf92cb3c
commit 397a157e8d
No known key found for this signature in database
GPG Key ID: E2F3D7916E722D38
2 changed files with 4 additions and 3 deletions

View File

@ -1479,7 +1479,7 @@ void CSigSharesManager::WorkThreadMain()
void CSigSharesManager::AsyncSign(const CQuorumCPtr& quorum, const uint256& id, const uint256& msgHash) void CSigSharesManager::AsyncSign(const CQuorumCPtr& quorum, const uint256& id, const uint256& msgHash)
{ {
LOCK(cs); LOCK(cs_pendingSigns);
pendingSigns.emplace_back(quorum, id, msgHash); pendingSigns.emplace_back(quorum, id, msgHash);
} }
@ -1487,7 +1487,7 @@ void CSigSharesManager::SignPendingSigShares()
{ {
std::vector<PendingSignatureData> v; std::vector<PendingSignatureData> v;
{ {
LOCK(cs); LOCK(cs_pendingSigns);
v = std::move(pendingSigns); v = std::move(pendingSigns);
} }

View File

@ -399,7 +399,8 @@ private:
PendingSignatureData(CQuorumCPtr quorum, const uint256& id, const uint256& msgHash) : quorum(std::move(quorum)), id(id), msgHash(msgHash){} PendingSignatureData(CQuorumCPtr quorum, const uint256& id, const uint256& msgHash) : quorum(std::move(quorum)), id(id), msgHash(msgHash){}
}; };
std::vector<PendingSignatureData> pendingSigns GUARDED_BY(cs); Mutex cs_pendingSigns;
std::vector<PendingSignatureData> pendingSigns GUARDED_BY(cs_pendingSigns);
FastRandomContext rnd GUARDED_BY(cs); FastRandomContext rnd GUARDED_BY(cs);