aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2022-02-23 15:21:09 -0500
committerCarl Dong <contact@carldong.me>2022-04-19 14:34:56 -0400
commitc96524113c48553c4bbad63077a25494eca8159e (patch)
tree84cdd604655d1de73954e91a055039747e55b564 /src/validation.cpp
parent73eedaaacc3b5f2dd791997109f2f5312a894336 (diff)
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.
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 9a68f8591a..82b543230b 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -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;
}