diff options
author | Carl Dong <contact@carldong.me> | 2021-01-12 13:38:53 -0500 |
---|---|---|
committer | Carl Dong <contact@carldong.me> | 2022-04-27 11:13:38 -0400 |
commit | 7ab07e033237d6ea179a6a2c76575ed6bd01a670 (patch) | |
tree | dd76d0815b961ca6c166c48de8261d20ef6c3f92 /src/node | |
parent | 7d99d725cdb5428ed25dc07c2d7fddf420da7786 (diff) | |
download | bitcoin-7ab07e033237d6ea179a6a2c76575ed6bd01a670.tar.xz |
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.
Diffstat (limited to 'src/node')
-rw-r--r-- | src/node/blockstorage.cpp | 14 | ||||
-rw-r--r-- | src/node/blockstorage.h | 8 |
2 files changed, 0 insertions, 22 deletions
diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp index 8ed22bbbce..25771aacee 100644 --- a/src/node/blockstorage.cpp +++ b/src/node/blockstorage.cpp @@ -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); diff --git a/src/node/blockstorage.h b/src/node/blockstorage.h index e4b9657372..622eac7fef 100644 --- a/src/node/blockstorage.h +++ b/src/node/blockstorage.h @@ -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 |