mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
validation: Move warningcache to ChainstateManager
This commit is contained in:
parent
68828288e5
commit
552684976b
2 changed files with 3 additions and 8 deletions
|
@ -2005,8 +2005,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
static std::array<ThresholdConditionCache, VERSIONBITS_NUM_BITS> warningcache GUARDED_BY(cs_main);
|
||||
|
||||
static unsigned int GetBlockScriptFlags(const CBlockIndex& block_index, const ChainstateManager& chainman)
|
||||
{
|
||||
const Consensus::Params& consensusparams = chainman.GetConsensus();
|
||||
|
@ -2662,7 +2660,7 @@ void Chainstate::UpdateTip(const CBlockIndex* pindexNew)
|
|||
const CBlockIndex* pindex = pindexNew;
|
||||
for (int bit = 0; bit < VERSIONBITS_NUM_BITS; bit++) {
|
||||
WarningBitsConditionChecker checker(m_chainman, bit);
|
||||
ThresholdState state = checker.GetStateFor(pindex, params.GetConsensus(), warningcache.at(bit));
|
||||
ThresholdState state = checker.GetStateFor(pindex, params.GetConsensus(), m_chainman.m_warningcache.at(bit));
|
||||
if (state == ThresholdState::ACTIVE || state == ThresholdState::LOCKED_IN) {
|
||||
const bilingual_str warning = strprintf(_("Unknown new rules activated (versionbit %i)"), bit);
|
||||
if (state == ThresholdState::ACTIVE) {
|
||||
|
@ -5593,11 +5591,6 @@ ChainstateManager::~ChainstateManager()
|
|||
LOCK(::cs_main);
|
||||
|
||||
m_versionbitscache.Clear();
|
||||
|
||||
// TODO: The warning cache should probably become non-global
|
||||
for (auto& i : warningcache) {
|
||||
i.clear();
|
||||
}
|
||||
}
|
||||
|
||||
bool ChainstateManager::DetectSnapshotChainstate(CTxMemPool* mempool)
|
||||
|
|
|
@ -936,6 +936,8 @@ private:
|
|||
//! nullopt.
|
||||
std::optional<int> GetSnapshotBaseHeight() const EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
|
||||
|
||||
std::array<ThresholdConditionCache, VERSIONBITS_NUM_BITS> m_warningcache GUARDED_BY(::cs_main);
|
||||
|
||||
//! Return true if a chainstate is considered usable.
|
||||
//!
|
||||
//! This is false when a background validation chainstate has completed its
|
||||
|
|
Loading…
Add table
Reference in a new issue