validation, refactoring: remove ChainstateManager::Reset()

Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
Co-authored-by: laanwj <126646+laanwj@users.noreply.github.com>
This commit is contained in:
Jon Atack 2022-02-08 20:56:14 +01:00
parent daad0093e3
commit ae9ceed3e2
No known key found for this signature in database
GPG key ID: 796C4109063D4EAF
3 changed files with 1 additions and 15 deletions

View file

@ -183,7 +183,6 @@ ChainTestingSetup::~ChainTestingSetup()
WITH_LOCK(::cs_main, UnloadBlockIndex(m_node.mempool.get(), *m_node.chainman));
m_node.mempool.reset();
m_node.scheduler.reset();
m_node.chainman->Reset();
m_node.chainman.reset();
}

View file

@ -5009,15 +5009,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()
{
if (m_ibd_chainstate && !m_snapshot_chainstate) {

View file

@ -985,17 +985,13 @@ public:
//! Unload block index and chain data before shutdown.
void Unload() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
//! Clear (deconstruct) chainstate data.
void Reset();
//! Check to see if caches are out of balance and if so, call
//! ResizeCoinsCaches() as needed.
void MaybeRebalanceCaches() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
~ChainstateManager() {
LOCK(::cs_main);
UnloadBlockIndex(/* mempool */ nullptr, *this);
Reset();
UnloadBlockIndex(/*mempool=*/nullptr, *this);
}
};