Skip to content

Commit 0f39da9

Browse files
Merge #6417: refactor: introduce cs_pendingSigns
397a157 refactor: introduce cs_pendingSigns (pasta) Pull request description: ## Issue being fixed or feature implemented Much more minimal version of #6410; data from testnet while MNs were doing lots of instantsend locking showed minimal contention over signing_shares cs, however, the contention that did exist, most was a result of AsyncSign conflicting with something else. This should resolve the vast majority of contention in signing_shares while minimizing the complication / risk of introducing dead locks compared to 6410 ## What was done? introduce cs_pendingSigns ## How Has This Been Tested? Built locally ## Breaking Changes None ## Checklist: _Go over all the following points, and put an `x` in all the boxes that apply._ - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: knst: utACK 397a157 UdjinM6: utACK 397a157 Tree-SHA512: aac741c274449cf9c22625ac95e964d275dd1454647eaa2fc064c90b44a215e5509c9f9b8aceccbd49002edc21cbea883900f202204aa2138c104f4989ae5e26
2 parents 242dc51 + 397a157 commit 0f39da9

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/llmq/signing_shares.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1479,15 +1479,15 @@ void CSigSharesManager::WorkThreadMain()
14791479

14801480
void CSigSharesManager::AsyncSign(const CQuorumCPtr& quorum, const uint256& id, const uint256& msgHash)
14811481
{
1482-
LOCK(cs);
1482+
LOCK(cs_pendingSigns);
14831483
pendingSigns.emplace_back(quorum, id, msgHash);
14841484
}
14851485

14861486
void CSigSharesManager::SignPendingSigShares()
14871487
{
14881488
std::vector<PendingSignatureData> v;
14891489
{
1490-
LOCK(cs);
1490+
LOCK(cs_pendingSigns);
14911491
v = std::move(pendingSigns);
14921492
}
14931493

src/llmq/signing_shares.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ class CSigSharesManager : public CRecoveredSigsListener
399399
PendingSignatureData(CQuorumCPtr quorum, const uint256& id, const uint256& msgHash) : quorum(std::move(quorum)), id(id), msgHash(msgHash){}
400400
};
401401

402-
std::vector<PendingSignatureData> pendingSigns GUARDED_BY(cs);
402+
Mutex cs_pendingSigns;
403+
std::vector<PendingSignatureData> pendingSigns GUARDED_BY(cs_pendingSigns);
403404

404405
FastRandomContext rnd GUARDED_BY(cs);
405406

0 commit comments

Comments
 (0)