mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
fix(llmq): use keepOldConnections (#4932)
We must scan/cache keepOldConnections quorums or we won't be able to process sig shares signed in the 8 blocks window (signig offset) once new quorum(s) are mined.
This commit is contained in:
parent
8a1a86b063
commit
0ca9fc087c
@ -195,8 +195,7 @@ void CQuorumManager::TriggerQuorumDataRecoveryThreads(const CBlockIndex* pIndex)
|
|||||||
LogPrint(BCLog::LLMQ, "CQuorumManager::%s -- Process block %s\n", __func__, pIndex->GetBlockHash().ToString());
|
LogPrint(BCLog::LLMQ, "CQuorumManager::%s -- Process block %s\n", __func__, pIndex->GetBlockHash().ToString());
|
||||||
|
|
||||||
for (auto& params : Params().GetConsensus().llmqs) {
|
for (auto& params : Params().GetConsensus().llmqs) {
|
||||||
// Process signingActiveQuorumCount + 1 quorums for all available llmqTypes
|
const auto vecQuorums = ScanQuorums(params.type, pIndex, params.keepOldConnections);
|
||||||
const auto vecQuorums = ScanQuorums(params.type, pIndex, params.signingActiveQuorumCount + 1);
|
|
||||||
|
|
||||||
// First check if we are member of any quorum of this type
|
// First check if we are member of any quorum of this type
|
||||||
auto proTxHash = WITH_LOCK(activeMasternodeInfoCs, return activeMasternodeInfo.proTxHash);
|
auto proTxHash = WITH_LOCK(activeMasternodeInfoCs, return activeMasternodeInfo.proTxHash);
|
||||||
|
@ -798,7 +798,7 @@ bool CLLMQUtils::IsQuorumActive(Consensus::LLMQType llmqType, const uint256& quo
|
|||||||
// sig shares and recovered sigs are only accepted from recent/active quorums
|
// sig shares and recovered sigs are only accepted from recent/active quorums
|
||||||
// we allow one more active quorum as specified in consensus, as otherwise there is a small window where things could
|
// we allow one more active quorum as specified in consensus, as otherwise there is a small window where things could
|
||||||
// fail while we are on the brink of a new quorum
|
// fail while we are on the brink of a new quorum
|
||||||
auto quorums = quorumManager->ScanQuorums(llmqType, GetLLMQParams(llmqType).signingActiveQuorumCount + 1);
|
auto quorums = quorumManager->ScanQuorums(llmqType, GetLLMQParams(llmqType).keepOldConnections);
|
||||||
return ranges::any_of(quorums, [&quorumHash](const auto& q){ return q->qc->quorumHash == quorumHash; });
|
return ranges::any_of(quorums, [&quorumHash](const auto& q){ return q->qc->quorumHash == quorumHash; });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -942,7 +942,7 @@ void CLLMQUtils::InitQuorumsCache(CacheType& cache)
|
|||||||
{
|
{
|
||||||
for (auto& llmq : Params().GetConsensus().llmqs) {
|
for (auto& llmq : Params().GetConsensus().llmqs) {
|
||||||
cache.emplace(std::piecewise_construct, std::forward_as_tuple(llmq.type),
|
cache.emplace(std::piecewise_construct, std::forward_as_tuple(llmq.type),
|
||||||
std::forward_as_tuple(llmq.signingActiveQuorumCount + 1));
|
std::forward_as_tuple(llmq.keepOldConnections));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
template void CLLMQUtils::InitQuorumsCache<std::map<Consensus::LLMQType, unordered_lru_cache<uint256, bool, StaticSaltedHasher>>>(std::map<Consensus::LLMQType, unordered_lru_cache<uint256, bool, StaticSaltedHasher>>& cache);
|
template void CLLMQUtils::InitQuorumsCache<std::map<Consensus::LLMQType, unordered_lru_cache<uint256, bool, StaticSaltedHasher>>>(std::map<Consensus::LLMQType, unordered_lru_cache<uint256, bool, StaticSaltedHasher>>& cache);
|
||||||
|
Loading…
Reference in New Issue
Block a user