Skip to content

Commit

Permalink
Merge dashpay#6417: refactor: introduce cs_pendingSigns
Browse files Browse the repository at this point in the history
397a157 refactor: introduce cs_pendingSigns (pasta)

Pull request description:

  ## Issue being fixed or feature implemented
  Much more minimal version of dashpay#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
  • Loading branch information
PastaPastaPasta committed Nov 21, 2024
2 parents 242dc51 + 397a157 commit 0f39da9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/llmq/signing_shares.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1479,15 +1479,15 @@ void CSigSharesManager::WorkThreadMain()

void CSigSharesManager::AsyncSign(const CQuorumCPtr& quorum, const uint256& id, const uint256& msgHash)
{
LOCK(cs);
LOCK(cs_pendingSigns);
pendingSigns.emplace_back(quorum, id, msgHash);
}

void CSigSharesManager::SignPendingSigShares()
{
std::vector<PendingSignatureData> v;
{
LOCK(cs);
LOCK(cs_pendingSigns);
v = std::move(pendingSigns);
}

Expand Down
3 changes: 2 additions & 1 deletion src/llmq/signing_shares.h
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,8 @@ class CSigSharesManager : public CRecoveredSigsListener
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);

Expand Down

0 comments on commit 0f39da9

Please sign in to comment.