Skip to content

Commit

Permalink
fix: deadlock over cs_main and contributionsCacheCs in dkssessionmgr
Browse files Browse the repository at this point in the history
It fixes rpc failure: "Work queue depth exceeded"
  • Loading branch information
knst committed Mar 28, 2024
1 parent 2a44f2e commit ded1b5a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/llmq/dkgsessionmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ void CDKGSessionManager::WriteEncryptedContributions(Consensus::LLMQType llmqTyp

bool CDKGSessionManager::GetVerifiedContributions(Consensus::LLMQType llmqType, const CBlockIndex* pQuorumBaseBlockIndex, const std::vector<bool>& validMembers, std::vector<uint16_t>& memberIndexesRet, std::vector<BLSVerificationVectorPtr>& vvecsRet, std::vector<CBLSSecretKey>& skContributionsRet) const
{
LOCK(contributionsCacheCs);
auto members = utils::GetAllQuorumMembers(llmqType, m_dmnman, pQuorumBaseBlockIndex);

memberIndexesRet.clear();
Expand All @@ -399,6 +398,9 @@ bool CDKGSessionManager::GetVerifiedContributions(Consensus::LLMQType llmqType,
memberIndexesRet.reserve(members.size());
vvecsRet.reserve(members.size());
skContributionsRet.reserve(members.size());

// NOTE: the `cs_main` should not be locked under scope of `contributionsCacheCs`
LOCK(contributionsCacheCs);
for (const auto i : irange::range(members.size())) {
if (validMembers[i]) {
const uint256& proTxHash = members[i]->proTxHash;
Expand Down

0 comments on commit ded1b5a

Please sign in to comment.