mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge #6396: refactor: Drop llmq split migration logic (dead code)
4622d9e04a
refactor: Drop llmq split migration logic (dead code) (UdjinM6) Pull request description: ## Issue being fixed or feature implemented This code was introduced in #4141 and it does essentially nothing now (db is not empty so it bails out early). It was used by masternodes only so it's safe to drop it completely, no outdated node needs it. ## What was done? ## How Has This Been Tested? ## Breaking Changes ## Checklist: - [ ] I have performed a self-review of my own code - [ ] 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 - [ ] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: PastaPastaPasta: utACK4622d9e04a
knst: utACK4622d9e04a
kwvg: utACK4622d9e04a
Tree-SHA512: 7ed85734c0ae13d5ffabe9e0d9cf9754f6beed5f915f1d4a5aa53d1cf32f3d2d0dedf357966d03101fa1f3f9ba67f048e5c4b9bf6d9ffbafe4a50049ddc87eda
This commit is contained in:
commit
12e5e32d83
@ -47,8 +47,6 @@ CDKGSessionManager::CDKGSessionManager(CBLSWorker& _blsWorker, CChainState& chai
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MigrateDKG();
|
|
||||||
|
|
||||||
const Consensus::Params& consensus_params = Params().GetConsensus();
|
const Consensus::Params& consensus_params = Params().GetConsensus();
|
||||||
for (const auto& params : consensus_params.llmqs) {
|
for (const auto& params : consensus_params.llmqs) {
|
||||||
auto session_count = (params.useRotation) ? params.signingActiveQuorumCount : 1;
|
auto session_count = (params.useRotation) ? params.signingActiveQuorumCount : 1;
|
||||||
@ -62,96 +60,6 @@ CDKGSessionManager::CDKGSessionManager(CBLSWorker& _blsWorker, CChainState& chai
|
|||||||
}
|
}
|
||||||
|
|
||||||
CDKGSessionManager::~CDKGSessionManager() = default;
|
CDKGSessionManager::~CDKGSessionManager() = default;
|
||||||
|
|
||||||
void CDKGSessionManager::MigrateDKG()
|
|
||||||
{
|
|
||||||
if (!db->IsEmpty()) return;
|
|
||||||
|
|
||||||
LogPrint(BCLog::LLMQ, "CDKGSessionManager::%d -- start\n", __func__);
|
|
||||||
|
|
||||||
CDBBatch batch(*db);
|
|
||||||
auto oldDb = std::make_unique<CDBWrapper>(gArgs.GetDataDirNet() / "llmq", 8 << 20);
|
|
||||||
std::unique_ptr<CDBIterator> pcursor(oldDb->NewIterator());
|
|
||||||
|
|
||||||
auto start_vvec = std::make_tuple(DB_VVEC, (Consensus::LLMQType)0, uint256(), uint256());
|
|
||||||
pcursor->Seek(start_vvec);
|
|
||||||
|
|
||||||
while (pcursor->Valid()) {
|
|
||||||
decltype(start_vvec) k;
|
|
||||||
std::vector<CBLSPublicKey> v;
|
|
||||||
|
|
||||||
if (!pcursor->GetKey(k) || std::get<0>(k) != DB_VVEC) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!pcursor->GetValue(v)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
batch.Write(k, v);
|
|
||||||
|
|
||||||
if (batch.SizeEstimate() >= (1 << 24)) {
|
|
||||||
db->WriteBatch(batch);
|
|
||||||
batch.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
pcursor->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto start_contrib = std::make_tuple(DB_SKCONTRIB, (Consensus::LLMQType)0, uint256(), uint256());
|
|
||||||
pcursor->Seek(start_contrib);
|
|
||||||
|
|
||||||
while (pcursor->Valid()) {
|
|
||||||
decltype(start_contrib) k;
|
|
||||||
CBLSSecretKey v;
|
|
||||||
|
|
||||||
if (!pcursor->GetKey(k) || std::get<0>(k) != DB_SKCONTRIB) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!pcursor->GetValue(v)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
batch.Write(k, v);
|
|
||||||
|
|
||||||
if (batch.SizeEstimate() >= (1 << 24)) {
|
|
||||||
db->WriteBatch(batch);
|
|
||||||
batch.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
pcursor->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto start_enc_contrib = std::make_tuple(DB_ENC_CONTRIB, (Consensus::LLMQType)0, uint256(), uint256());
|
|
||||||
pcursor->Seek(start_enc_contrib);
|
|
||||||
|
|
||||||
while (pcursor->Valid()) {
|
|
||||||
decltype(start_enc_contrib) k;
|
|
||||||
CBLSIESMultiRecipientObjects<CBLSSecretKey> v;
|
|
||||||
|
|
||||||
if (!pcursor->GetKey(k) || std::get<0>(k) != DB_ENC_CONTRIB) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!pcursor->GetValue(v)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
batch.Write(k, v);
|
|
||||||
|
|
||||||
if (batch.SizeEstimate() >= (1 << 24)) {
|
|
||||||
db->WriteBatch(batch);
|
|
||||||
batch.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
pcursor->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
db->WriteBatch(batch);
|
|
||||||
pcursor.reset();
|
|
||||||
oldDb.reset();
|
|
||||||
|
|
||||||
LogPrint(BCLog::LLMQ, "CDKGSessionManager::%d -- done\n", __func__);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CDKGSessionManager::StartThreads()
|
void CDKGSessionManager::StartThreads()
|
||||||
{
|
{
|
||||||
for (auto& it : dkgSessionHandlers) {
|
for (auto& it : dkgSessionHandlers) {
|
||||||
|
@ -101,7 +101,6 @@ public:
|
|||||||
void CleanupOldContributions() const;
|
void CleanupOldContributions() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void MigrateDKG();
|
|
||||||
void CleanupCache() const;
|
void CleanupCache() const;
|
||||||
};
|
};
|
||||||
} // namespace llmq
|
} // namespace llmq
|
||||||
|
@ -46,196 +46,10 @@ UniValue CRecoveredSig::ToJson() const
|
|||||||
CRecoveredSigsDb::CRecoveredSigsDb(bool fMemory, bool fWipe) :
|
CRecoveredSigsDb::CRecoveredSigsDb(bool fMemory, bool fWipe) :
|
||||||
db(std::make_unique<CDBWrapper>(fMemory ? "" : (gArgs.GetDataDirNet() / "llmq/recsigdb"), 8 << 20, fMemory, fWipe))
|
db(std::make_unique<CDBWrapper>(fMemory ? "" : (gArgs.GetDataDirNet() / "llmq/recsigdb"), 8 << 20, fMemory, fWipe))
|
||||||
{
|
{
|
||||||
MigrateRecoveredSigs();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CRecoveredSigsDb::~CRecoveredSigsDb() = default;
|
CRecoveredSigsDb::~CRecoveredSigsDb() = default;
|
||||||
|
|
||||||
void CRecoveredSigsDb::MigrateRecoveredSigs()
|
|
||||||
{
|
|
||||||
if (!db->IsEmpty()) return;
|
|
||||||
|
|
||||||
LogPrint(BCLog::LLMQ, "CRecoveredSigsDb::%d -- start\n", __func__);
|
|
||||||
|
|
||||||
CDBBatch batch(*db);
|
|
||||||
auto oldDb = std::make_unique<CDBWrapper>(gArgs.GetDataDirNet() / "llmq", 8 << 20);
|
|
||||||
std::unique_ptr<CDBIterator> pcursor(oldDb->NewIterator());
|
|
||||||
|
|
||||||
auto start_h = std::make_tuple(std::string("rs_h"), uint256());
|
|
||||||
pcursor->Seek(start_h);
|
|
||||||
|
|
||||||
while (pcursor->Valid()) {
|
|
||||||
decltype(start_h) k;
|
|
||||||
std::pair<Consensus::LLMQType, uint256> v;
|
|
||||||
|
|
||||||
if (!pcursor->GetKey(k) || std::get<0>(k) != "rs_h") {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!pcursor->GetValue(v)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
batch.Write(k, v);
|
|
||||||
|
|
||||||
if (batch.SizeEstimate() >= (1 << 24)) {
|
|
||||||
db->WriteBatch(batch);
|
|
||||||
batch.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
pcursor->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto start_r1 = std::make_tuple(std::string("rs_r"), (Consensus::LLMQType)0, uint256());
|
|
||||||
pcursor->Seek(start_r1);
|
|
||||||
|
|
||||||
while (pcursor->Valid()) {
|
|
||||||
decltype(start_r1) k;
|
|
||||||
CRecoveredSig v;
|
|
||||||
|
|
||||||
if (!pcursor->GetKey(k) || std::get<0>(k) != "rs_r") {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!pcursor->GetValue(v)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
batch.Write(k, v);
|
|
||||||
|
|
||||||
if (batch.SizeEstimate() >= (1 << 24)) {
|
|
||||||
db->WriteBatch(batch);
|
|
||||||
batch.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
pcursor->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto start_r2 = std::make_tuple(std::string("rs_r"), (Consensus::LLMQType)0, uint256(), uint256());
|
|
||||||
pcursor->Seek(start_r2);
|
|
||||||
|
|
||||||
while (pcursor->Valid()) {
|
|
||||||
decltype(start_r2) k;
|
|
||||||
uint32_t v;
|
|
||||||
|
|
||||||
if (!pcursor->GetKey(k) || std::get<0>(k) != "rs_r") {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!pcursor->GetValue(v)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
batch.Write(k, v);
|
|
||||||
|
|
||||||
if (batch.SizeEstimate() >= (1 << 24)) {
|
|
||||||
db->WriteBatch(batch);
|
|
||||||
batch.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
pcursor->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto start_s = std::make_tuple(std::string("rs_s"), uint256());
|
|
||||||
pcursor->Seek(start_s);
|
|
||||||
|
|
||||||
while (pcursor->Valid()) {
|
|
||||||
decltype(start_s) k;
|
|
||||||
uint8_t v;
|
|
||||||
|
|
||||||
if (!pcursor->GetKey(k) || std::get<0>(k) != "rs_s") {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!pcursor->GetValue(v)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
batch.Write(k, v);
|
|
||||||
|
|
||||||
if (batch.SizeEstimate() >= (1 << 24)) {
|
|
||||||
db->WriteBatch(batch);
|
|
||||||
batch.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
pcursor->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto start_t = std::make_tuple(std::string("rs_t"), (uint32_t)0, (Consensus::LLMQType)0, uint256());
|
|
||||||
pcursor->Seek(start_t);
|
|
||||||
|
|
||||||
while (pcursor->Valid()) {
|
|
||||||
decltype(start_t) k;
|
|
||||||
uint8_t v;
|
|
||||||
|
|
||||||
if (!pcursor->GetKey(k) || std::get<0>(k) != "rs_t") {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!pcursor->GetValue(v)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
batch.Write(k, v);
|
|
||||||
|
|
||||||
if (batch.SizeEstimate() >= (1 << 24)) {
|
|
||||||
db->WriteBatch(batch);
|
|
||||||
batch.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
pcursor->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto start_v = std::make_tuple(std::string("rs_v"), (Consensus::LLMQType)0, uint256());
|
|
||||||
pcursor->Seek(start_v);
|
|
||||||
|
|
||||||
while (pcursor->Valid()) {
|
|
||||||
decltype(start_v) k;
|
|
||||||
uint256 v;
|
|
||||||
|
|
||||||
if (!pcursor->GetKey(k) || std::get<0>(k) != "rs_v") {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!pcursor->GetValue(v)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
batch.Write(k, v);
|
|
||||||
|
|
||||||
if (batch.SizeEstimate() >= (1 << 24)) {
|
|
||||||
db->WriteBatch(batch);
|
|
||||||
batch.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
pcursor->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto start_vt = std::make_tuple(std::string("rs_vt"), (uint32_t)0, (Consensus::LLMQType)0, uint256());
|
|
||||||
pcursor->Seek(start_vt);
|
|
||||||
|
|
||||||
while (pcursor->Valid()) {
|
|
||||||
decltype(start_vt) k;
|
|
||||||
uint8_t v;
|
|
||||||
|
|
||||||
if (!pcursor->GetKey(k) || std::get<0>(k) != "rs_vt") {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!pcursor->GetValue(v)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
batch.Write(k, v);
|
|
||||||
|
|
||||||
if (batch.SizeEstimate() >= (1 << 24)) {
|
|
||||||
db->WriteBatch(batch);
|
|
||||||
batch.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
pcursor->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
db->WriteBatch(batch);
|
|
||||||
pcursor.reset();
|
|
||||||
oldDb.reset();
|
|
||||||
|
|
||||||
LogPrint(BCLog::LLMQ, "CRecoveredSigsDb::%d -- done\n", __func__);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CRecoveredSigsDb::HasRecoveredSig(Consensus::LLMQType llmqType, const uint256& id, const uint256& msgHash) const
|
bool CRecoveredSigsDb::HasRecoveredSig(Consensus::LLMQType llmqType, const uint256& id, const uint256& msgHash) const
|
||||||
{
|
{
|
||||||
auto k = std::make_tuple(std::string("rs_r"), llmqType, id, msgHash);
|
auto k = std::make_tuple(std::string("rs_r"), llmqType, id, msgHash);
|
||||||
|
@ -143,8 +143,6 @@ public:
|
|||||||
void CleanupOldVotes(int64_t maxAge);
|
void CleanupOldVotes(int64_t maxAge);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void MigrateRecoveredSigs();
|
|
||||||
|
|
||||||
bool ReadRecoveredSig(Consensus::LLMQType llmqType, const uint256& id, CRecoveredSig& ret) const;
|
bool ReadRecoveredSig(Consensus::LLMQType llmqType, const uint256& id, CRecoveredSig& ret) const;
|
||||||
void RemoveRecoveredSig(CDBBatch& batch, Consensus::LLMQType llmqType, const uint256& id, bool deleteHashKey, bool deleteTimeKey);
|
void RemoveRecoveredSig(CDBBatch& batch, Consensus::LLMQType llmqType, const uint256& id, bool deleteHashKey, bool deleteTimeKey);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user