Skip to content

Commit

Permalink
perf: re-use evo data about signals between v20 and mn_rr as non-corr…
Browse files Browse the repository at this point in the history
…upted
  • Loading branch information
knst committed Nov 27, 2024
1 parent 7a7c9f1 commit c6bb9a5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/evo/mnhftx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit c6bb9a5

Please sign in to comment.