aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorlaanwj <126646+laanwj@users.noreply.github.com>2022-03-07 11:49:16 +0100
committerlaanwj <126646+laanwj@users.noreply.github.com>2022-03-07 12:13:32 +0100
commitcba41db327a241f992f9329b214d9070888255b8 (patch)
treef37523924cd3afe9ade1279523425f5f047a7162 /src/validation.cpp
parentf6d335e82822ed8f2da56c1bcaddf7f99acd4997 (diff)
parentae9ceed3e23288b163b7d7b1840b06b8d332f4ce (diff)
Merge bitcoin/bitcoin#24299: validation, refactor: UnloadBlockIndex and ChainstateManager::Reset thread safety cleanups
ae9ceed3e23288b163b7d7b1840b06b8d332f4ce validation, refactoring: remove ChainstateManager::Reset() (Jon Atack) daad0093e3d1466789d0ce687902636c80cd74a1 validation: replace lock with annotation in UnloadBlockIndex() (Jon Atack) Pull request description: Thread safety refactoring seen in #24177: - replace re-acquiring lock cs_main with a thread safety annotation in UnloadBlockIndex() - remove ChainstateManager::Reset(), as it is currently unused (can be reintroduced in the test utilities if needed for unit testing) ACKs for top commit: laanwj: Code review ACK ae9ceed3e23288b163b7d7b1840b06b8d332f4ce vasild: ACK ae9ceed3e23288b163b7d7b1840b06b8d332f4ce klementtan: crACK ae9ceed3e23288b163b7d7b1840b06b8d332f4ce Tree-SHA512: cebb782572997cc2dda01590d6bb6c5e479e8202324d8b6ff459b814ce09e818b996c881736bfebd1b8bf4b6d7a0f79faf3ffea176a4699dd7d7429de2db2d13
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 214112e2bd..c89c293a85 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -4070,7 +4070,7 @@ void CChainState::UnloadBlockIndex()
// block index state
void UnloadBlockIndex(CTxMemPool* mempool, ChainstateManager& chainman)
{
- LOCK(cs_main);
+ AssertLockHeld(::cs_main);
chainman.Unload();
pindexBestHeader = nullptr;
if (mempool) mempool->clear();
@@ -5056,15 +5056,6 @@ void ChainstateManager::Unload()
m_best_invalid = nullptr;
}
-void ChainstateManager::Reset()
-{
- LOCK(::cs_main);
- m_ibd_chainstate.reset();
- m_snapshot_chainstate.reset();
- m_active_chainstate = nullptr;
- m_snapshot_validated = false;
-}
-
void ChainstateManager::MaybeRebalanceCaches()
{
AssertLockHeld(::cs_main);