diff options
author | MarcoFalke <falke.marco@gmail.com> | 2022-01-05 16:23:55 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2022-01-05 16:15:04 +0100 |
commit | fab262174b96854d2df5bee7da578990c9e9cb1e (patch) | |
tree | 475886d4eeed03785c333733a6b625365d15e095 | |
parent | fa467f3913918701c765f9bc754203b4591b894f (diff) |
Move blockstorage-related unload to BlockManager::Unload
This is a refactor and safe to do because:
* UnloadBlockIndex calls ChainstateManager::Unload, which calls
BlockManager::Unload
* Only unit tests call Unload directly
-rw-r--r-- | src/node/blockstorage.cpp | 5 | ||||
-rw-r--r-- | src/validation.cpp | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp index 3cc53e27e2..a040f2e7b4 100644 --- a/src/node/blockstorage.cpp +++ b/src/node/blockstorage.cpp @@ -348,6 +348,11 @@ void BlockManager::Unload() } m_block_index.clear(); + + vinfoBlockFile.clear(); + nLastBlockFile = 0; + setDirtyBlockIndex.clear(); + setDirtyFileInfo.clear(); } bool BlockManager::WriteBlockIndexDB() diff --git a/src/validation.cpp b/src/validation.cpp index 58bced48c9..db1a96498c 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3980,10 +3980,6 @@ void UnloadBlockIndex(CTxMemPool* mempool, ChainstateManager& chainman) chainman.Unload(); pindexBestHeader = nullptr; if (mempool) mempool->clear(); - vinfoBlockFile.clear(); - nLastBlockFile = 0; - setDirtyBlockIndex.clear(); - setDirtyFileInfo.clear(); g_versionbitscache.Clear(); for (int b = 0; b < VERSIONBITS_NUM_BITS; b++) { warningcache[b].clear(); |