mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
validation: Prune UnloadBlockIndex and callees
In previous commits in this patchset, we've made sure that every Unload/UnloadBlockIndex member function resets its own members, and does not reach out to globals. This means that their corresponding classes' default destructors can now replace them, and do an even more thorough job without the need to be updated for every new member variable. Therefore, we can remove them, and also remove UnloadBlockIndex since that's not used anymore. Unfortunately, chainstatemanager_loadblockindex relies on CChainState::UnloadBlockIndex, so that needs to stay for now.
This commit is contained in:
@@ -297,20 +297,6 @@ bool BlockManager::LoadBlockIndex(const Consensus::Params& consensus_params)
|
||||
return true;
|
||||
}
|
||||
|
||||
void BlockManager::Unload()
|
||||
{
|
||||
m_blocks_unlinked.clear();
|
||||
|
||||
m_block_index.clear();
|
||||
|
||||
m_blockfile_info.clear();
|
||||
m_last_blockfile = 0;
|
||||
m_dirty_blockindex.clear();
|
||||
m_dirty_fileinfo.clear();
|
||||
|
||||
m_have_pruned = false;
|
||||
}
|
||||
|
||||
bool BlockManager::WriteBlockIndexDB()
|
||||
{
|
||||
AssertLockHeld(::cs_main);
|
||||
|
||||
@@ -154,9 +154,6 @@ public:
|
||||
bool WriteBlockIndexDB() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
|
||||
bool LoadBlockIndexDB() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
|
||||
|
||||
/** Clear all data members. */
|
||||
void Unload() EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
|
||||
CBlockIndex* AddToBlockIndex(const CBlockHeader& block, CBlockIndex*& best_header) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
/** Create a new block index entry for a given block hash */
|
||||
CBlockIndex* InsertBlockIndex(const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
@@ -189,11 +186,6 @@ public:
|
||||
|
||||
//! Create or update a prune lock identified by its name
|
||||
void UpdatePruneLock(const std::string& name, const PruneLockInfo& lock_info) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
|
||||
|
||||
~BlockManager()
|
||||
{
|
||||
Unload();
|
||||
}
|
||||
};
|
||||
|
||||
//! Find the first block that is not pruned
|
||||
|
||||
Reference in New Issue
Block a user