mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
fix: assert in signing_shares - amount of members can match with amount of attempts
Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com>
This commit is contained in:
parent
d754799580
commit
8286bdf611
@ -807,9 +807,9 @@ void CSigSharesManager::TryRecoverSig(const CQuorumCPtr& quorum, const uint256&
|
||||
sigman.ProcessRecoveredSig(rs);
|
||||
}
|
||||
|
||||
CDeterministicMNCPtr CSigSharesManager::SelectMemberForRecovery(const CQuorumCPtr& quorum, const uint256 &id, size_t attempt)
|
||||
CDeterministicMNCPtr CSigSharesManager::SelectMemberForRecovery(const CQuorumCPtr& quorum, const uint256 &id, int attempt)
|
||||
{
|
||||
assert(size_t(attempt) < quorum->members.size());
|
||||
assert(attempt < quorum->params.recoveryMembers);
|
||||
|
||||
std::vector<std::pair<uint256, CDeterministicMNCPtr>> v;
|
||||
v.reserve(quorum->members.size());
|
||||
@ -819,7 +819,7 @@ CDeterministicMNCPtr CSigSharesManager::SelectMemberForRecovery(const CQuorumCPt
|
||||
}
|
||||
std::sort(v.begin(), v.end());
|
||||
|
||||
return v[attempt].second;
|
||||
return v[attempt % v.size()].second;
|
||||
}
|
||||
|
||||
void CSigSharesManager::CollectSigSharesToRequest(std::unordered_map<NodeId, std::unordered_map<uint256, CSigSharesInv, StaticSaltedHasher>>& sigSharesToRequest)
|
||||
|
@ -434,7 +434,7 @@ public:
|
||||
|
||||
void HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) override;
|
||||
|
||||
static CDeterministicMNCPtr SelectMemberForRecovery(const CQuorumCPtr& quorum, const uint256& id, size_t attempt);
|
||||
static CDeterministicMNCPtr SelectMemberForRecovery(const CQuorumCPtr& quorum, const uint256& id, int attempt);
|
||||
|
||||
private:
|
||||
// all of these return false when the currently processed message should be aborted (as each message actually contains multiple messages)
|
||||
|
@ -732,7 +732,7 @@ static RPCHelpMan quorum_selectquorum()
|
||||
ret.pushKV("quorumHash", quorum->qc->quorumHash.ToString());
|
||||
|
||||
UniValue recoveryMembers(UniValue::VARR);
|
||||
for (size_t i = 0; i < size_t(quorum->params.recoveryMembers); i++) {
|
||||
for (int i = 0; i < quorum->params.recoveryMembers; ++i) {
|
||||
auto dmn = llmq_ctx.shareman->SelectMemberForRecovery(quorum, id, i);
|
||||
recoveryMembers.push_back(dmn->proTxHash.ToString());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user