mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
validation: Move ~CMainCleanup logic to ~BlockManager
~CMainCleanup: 1. Is vestigial 2. References the g_chainman global (we should minimize g_chainman refs) 3. Only acts on g_chainman.m_blockman 4. Does the same thing as BlockManager::Unload
This commit is contained in:
parent
147d50d63e
commit
4668ded6d6
2 changed files with 4 additions and 14 deletions
|
@ -5226,20 +5226,6 @@ double GuessVerificationProgress(const ChainTxData& data, const CBlockIndex *pin
|
|||
return std::min<double>(pindex->nChainTx / fTxTotal, 1.0);
|
||||
}
|
||||
|
||||
class CMainCleanup
|
||||
{
|
||||
public:
|
||||
CMainCleanup() {}
|
||||
~CMainCleanup() {
|
||||
// block headers
|
||||
BlockMap::iterator it1 = g_chainman.BlockIndex().begin();
|
||||
for (; it1 != g_chainman.BlockIndex().end(); it1++)
|
||||
delete (*it1).second;
|
||||
g_chainman.BlockIndex().clear();
|
||||
}
|
||||
};
|
||||
static CMainCleanup instance_of_cmaincleanup;
|
||||
|
||||
Optional<uint256> ChainstateManager::SnapshotBlockhash() const {
|
||||
if (m_active_chainstate != nullptr) {
|
||||
// If a snapshot chainstate exists, it will always be our active.
|
||||
|
|
|
@ -416,6 +416,10 @@ public:
|
|||
BlockValidationState& state,
|
||||
const CChainParams& chainparams,
|
||||
CBlockIndex** ppindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
|
||||
~BlockManager() {
|
||||
Unload();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue