mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
Clear pindexBestHeader in ChainstateManager::Unload()
-----
Code Reviewer Notes
Call graph of relevant functions:
UnloadBlockIndex() <-- Moved from
calls ChainstateManager::Unload() <-- Moved to
Safe because ChainstateManager::Unload() is called only by
UnloadBlockIndex() and no other callers.
This commit is contained in:
@@ -4122,7 +4122,6 @@ void UnloadBlockIndex(CTxMemPool* mempool, ChainstateManager& chainman)
|
||||
{
|
||||
AssertLockHeld(::cs_main);
|
||||
chainman.Unload();
|
||||
chainman.pindexBestHeader = nullptr;
|
||||
if (mempool) mempool->clear();
|
||||
g_versionbitscache.Clear();
|
||||
for (int b = 0; b < VERSIONBITS_NUM_BITS; b++) {
|
||||
@@ -5171,6 +5170,7 @@ void ChainstateManager::Unload()
|
||||
|
||||
m_failed_blocks.clear();
|
||||
m_blockman.Unload();
|
||||
pindexBestHeader = nullptr;
|
||||
m_best_invalid = nullptr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user