Skip to content

Commit c2354fb

Browse files
fix: keep platform quorum data for 2 months (dashpay#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 <[email protected]>
1 parent b1d249d commit c2354fb

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/llmq/quorums.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,18 +1003,24 @@ void CQuorumManager::CleanupOldQuorumData(const CBlockIndex* pIndex) const
10031003
return;
10041004
}
10051005

1006-
std::set<uint256> dbKeys;
1006+
std::set<uint256> dbKeysToSkip;
10071007

10081008
LogPrint(BCLog::LLMQ, "CQuorumManager::%d -- start\n", __func__);
1009+
// Platform quorums in all networks are created every 24 blocks (~1h).
1010+
// Unlike for other quorum types we want to keep data (secret key shares and vvec)
1011+
// for Platform quorums for at least 2 months because Platform can be restarted and
1012+
// it must be able to re-sign stuff. During a month, 24 * 30 quorums are created.
1013+
constexpr auto numPlatformQuorumsDataToKeep = 24 * 30 * 2;
10091014

10101015
for (const auto& params : Params().GetConsensus().llmqs) {
1011-
const auto vecQuorums = ScanQuorums(params.type, pIndex, params.keepOldConnections);
1016+
auto nQuorumsToKeep = params.type == Params().GetConsensus().llmqTypePlatform ? numPlatformQuorumsDataToKeep : params.keepOldConnections;
1017+
const auto vecQuorums = ScanQuorums(params.type, pIndex, nQuorumsToKeep);
10121018
for (const auto& pQuorum : vecQuorums) {
1013-
dbKeys.insert(MakeQuorumKey(*pQuorum));
1019+
dbKeysToSkip.insert(MakeQuorumKey(*pQuorum));
10141020
}
10151021
}
10161022

1017-
DataCleanupHelper(m_evoDb.GetRawDB(), dbKeys);
1023+
DataCleanupHelper(m_evoDb.GetRawDB(), dbKeysToSkip);
10181024

10191025
LogPrint(BCLog::LLMQ, "CQuorumManager::%d -- done\n", __func__);
10201026
}

0 commit comments

Comments
 (0)