Skip to content

Commit fab2621

Browse files
author
MarcoFalke
committed
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
1 parent fa467f3 commit fab2621

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/node/blockstorage.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,11 @@ void BlockManager::Unload()
348348
}
349349

350350
m_block_index.clear();
351+
352+
vinfoBlockFile.clear();
353+
nLastBlockFile = 0;
354+
setDirtyBlockIndex.clear();
355+
setDirtyFileInfo.clear();
351356
}
352357

353358
bool BlockManager::WriteBlockIndexDB()

src/validation.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -3980,10 +3980,6 @@ void UnloadBlockIndex(CTxMemPool* mempool, ChainstateManager& chainman)
39803980
chainman.Unload();
39813981
pindexBestHeader = nullptr;
39823982
if (mempool) mempool->clear();
3983-
vinfoBlockFile.clear();
3984-
nLastBlockFile = 0;
3985-
setDirtyBlockIndex.clear();
3986-
setDirtyFileInfo.clear();
39873983
g_versionbitscache.Clear();
39883984
for (int b = 0; b < VERSIONBITS_NUM_BITS; b++) {
39893985
warningcache[b].clear();

0 commit comments

Comments
 (0)