From c6bb9a56857c69fcf1358ebf2d9e710dfece3a84 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Wed, 27 Nov 2024 18:22:14 +0700 Subject: [PATCH] perf: re-use evo data about signals between v20 and mn_rr as non-corrupted --- src/evo/mnhftx.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/evo/mnhftx.cpp b/src/evo/mnhftx.cpp index ebc17439c1..79319477dd 100644 --- a/src/evo/mnhftx.cpp +++ b/src/evo/mnhftx.cpp @@ -23,6 +23,7 @@ #include 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::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; }