refactor: Delete ChainstateManager::IsSnapshotActive() method

IsSnapshotActive() method is only called one place outside of tests and
asserts, and is confusing because it returns true even after the snapshot is
fully validated.

The documentation which said this "implies that a background validation
chainstate is also in use" is also incorrect, because after the snapshot is
validated, the background chainstate gets disabled and IsUsable() would return
false.
This commit is contained in:
Ryan Ofsky
2024-05-31 07:00:40 -04:00
parent 4dfe383912
commit d9e82299fc
7 changed files with 15 additions and 24 deletions

View File

@@ -210,7 +210,6 @@ ChainstateLoadResult LoadChainstate(ChainstateManager& chainman, const CacheSize
// ChainstateManager::ResetChainstates(), reinitialize them here without
// duplicating the blockindex work above.
assert(chainman.GetAll().empty());
assert(!chainman.IsSnapshotActive());
assert(!chainman.IsSnapshotValidated());
chainman.InitializeChainstate(options.mempool);

View File

@@ -845,7 +845,8 @@ public:
}
bool hasAssumedValidChain() override
{
return chainman().IsSnapshotActive();
LOCK(::cs_main);
return bool{chainman().CurrentChainstate().m_from_snapshot_blockhash};
}
NodeContext* context() override { return &m_node; }