perf: re-use evo data about signals between v20 and mn_rr as non-corrupted

This commit is contained in:
Konstantin Akimov 2024-11-27 18:22:14 +07:00
parent 7a7c9f12a4
commit c6bb9a5685
No known key found for this signature in database
GPG Key ID: 2176C4A5D01EA524

View File

@ -23,6 +23,7 @@
#include <vector>
static const std::string MNEHF_REQUESTID_PREFIX = "mnhf";
static const std::string DB_SIGNALS = "mnhf";
static const std::string DB_SIGNALS_v2 = "mnhf_s2";
uint256 MNHFTxPayload::GetRequestId() const
@ -334,6 +335,14 @@ std::optional<CMNHFManager::Signals> CMNHFManager::GetFromCache(const CBlockInde
mnhfCache.insert(blockHash, signals);
return signals;
}
if (!DeploymentActiveAt(*pindex, Params().GetConsensus(), Consensus::DEPLOYMENT_MN_RR)) {
// before mn_rr activation we are safe
if (m_evoDb.Read(std::make_pair(DB_SIGNALS, blockHash), signals)) {
LOCK(cs_cache);
mnhfCache.insert(blockHash, signals);
return signals;
}
}
return std::nullopt;
}