mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
fix: keep platform quorum data for 2 months (#5690)
## Issue being fixed or feature implemented When Platform restarts on a network, it needs to sign requests using old quorums. We shouldn't remove data (secret key shares, vvec) for old Platform quorums as we do with the rest of the llmqs. ## What was done? We skip removing for Platform quorums younger than 2 months. ## How Has This Been Tested? ## Breaking Changes no ## Checklist: - [x] I have performed a self-review of my own code - [x] 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)_ --------- Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
This commit is contained in:
parent
b1d249d102
commit
c2354fb55f
@ -1003,18 +1003,24 @@ void CQuorumManager::CleanupOldQuorumData(const CBlockIndex* pIndex) const
|
||||
return;
|
||||
}
|
||||
|
||||
std::set<uint256> dbKeys;
|
||||
std::set<uint256> dbKeysToSkip;
|
||||
|
||||
LogPrint(BCLog::LLMQ, "CQuorumManager::%d -- start\n", __func__);
|
||||
// Platform quorums in all networks are created every 24 blocks (~1h).
|
||||
// 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.
|
||||
constexpr auto numPlatformQuorumsDataToKeep = 24 * 30 * 2;
|
||||
|
||||
for (const auto& params : Params().GetConsensus().llmqs) {
|
||||
const auto vecQuorums = ScanQuorums(params.type, pIndex, params.keepOldConnections);
|
||||
auto nQuorumsToKeep = params.type == Params().GetConsensus().llmqTypePlatform ? numPlatformQuorumsDataToKeep : params.keepOldConnections;
|
||||
const auto vecQuorums = ScanQuorums(params.type, pIndex, nQuorumsToKeep);
|
||||
for (const auto& pQuorum : vecQuorums) {
|
||||
dbKeys.insert(MakeQuorumKey(*pQuorum));
|
||||
dbKeysToSkip.insert(MakeQuorumKey(*pQuorum));
|
||||
}
|
||||
}
|
||||
|
||||
DataCleanupHelper(m_evoDb.GetRawDB(), dbKeys);
|
||||
DataCleanupHelper(m_evoDb.GetRawDB(), dbKeysToSkip);
|
||||
|
||||
LogPrint(BCLog::LLMQ, "CQuorumManager::%d -- done\n", __func__);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user