Skip to content
1 change: 1 addition & 0 deletions src/llmq/quorums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,7 @@ void CQuorumManager::CleanupOldQuorumData(const CBlockIndex* pIndex) const
// Unlike for other quorum types we want to keep data (secret key shares and vvec)
// for Platform quorums for at least 2 months because Platform can be restarted and
// it must be able to re-sign stuff. During a month, 24 * 30 quorums are created.
// NOTE: when changing this make sure to update InitQuorumsCache() accordingly
constexpr auto numPlatformQuorumsDataToKeep = 24 * 30 * 2;

for (const auto& params : Params().GetConsensus().llmqs) {
Expand Down
6 changes: 5 additions & 1 deletion src/llmq/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1087,9 +1087,13 @@ std::map<Consensus::LLMQType, QvvecSyncMode> GetEnabledQuorumVvecSyncEntries()
template <typename CacheType>
void InitQuorumsCache(CacheType& cache)
{
// NOTE: See CQuorumManager::CleanupOldQuorumData() for more info
constexpr auto numPlatformQuorumsDataToKeep = 24 * 30 * 2;
const auto llmqTypePlatform = Params().GetConsensus().llmqTypePlatform;
for (const auto& llmq : Params().GetConsensus().llmqs) {
const auto nQuorumsToKeep = llmq.type == llmqTypePlatform ? numPlatformQuorumsDataToKeep : llmq.keepOldConnections;
cache.emplace(std::piecewise_construct, std::forward_as_tuple(llmq.type),
std::forward_as_tuple(llmq.keepOldConnections));
std::forward_as_tuple(nQuorumsToKeep));
}
}
template void InitQuorumsCache<std::map<Consensus::LLMQType, unordered_lru_cache<uint256, bool, StaticSaltedHasher>>>(std::map<Consensus::LLMQType, unordered_lru_cache<uint256, bool, StaticSaltedHasher>>& cache);
Expand Down