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
This commit is contained in:
2 files changed
+5
-4
No files matched your search
@@ -348,6 +348,11 @@ void BlockManager::Unload()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_block_index.clear();
|
m_block_index.clear();
|
||||||
|
|
||||||
|
vinfoBlockFile.clear();
|
||||||
|
nLastBlockFile = 0;
|
||||||
|
setDirtyBlockIndex.clear();
|
||||||
|
setDirtyFileInfo.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BlockManager::WriteBlockIndexDB()
|
bool BlockManager::WriteBlockIndexDB()
|
||||||
|
|||||||
@@ -3980,10 +3980,6 @@ void UnloadBlockIndex(CTxMemPool* mempool, ChainstateManager& chainman)
|
|||||||
chainman.Unload();
|
chainman.Unload();
|
||||||
pindexBestHeader = nullptr;
|
pindexBestHeader = nullptr;
|
||||||
if (mempool) mempool->clear();
|
if (mempool) mempool->clear();
|
||||||
vinfoBlockFile.clear();
|
|
||||||
nLastBlockFile = 0;
|
|
||||||
setDirtyBlockIndex.clear();
|
|
||||||
setDirtyFileInfo.clear();
|
|
||||||
g_versionbitscache.Clear();
|
g_versionbitscache.Clear();
|
||||||
for (int b = 0; b < VERSIONBITS_NUM_BITS; b++) {
|
for (int b = 0; b < VERSIONBITS_NUM_BITS; b++) {
|
||||||
warningcache[b].clear();
|
warningcache[b].clear();
|
||||||
|
|||||||
Reference in new issue
Block a user