Move FindForkInGlobalIndex from BlockManager to CChainState

The helper was moved in commit b026e318c3,
which also mentioned that it could be moved to CChainState. So do that,
as the functionality is not block-storage related.

This also allows to drop one function argument.
This commit is contained in:
MarcoFalke
2021-11-23 18:07:00 +01:00
parent c09b41dc66
commit fa3d62cf7b
5 changed files with 15 additions and 14 deletions

View File

@@ -494,8 +494,8 @@ public:
std::optional<int> findLocatorFork(const CBlockLocator& locator) override
{
LOCK(cs_main);
const CChain& active = Assert(m_node.chainman)->ActiveChain();
if (CBlockIndex* fork = m_node.chainman->m_blockman.FindForkInGlobalIndex(active, locator)) {
const CChainState& active = Assert(m_node.chainman)->ActiveChainstate();
if (CBlockIndex* fork = active.FindForkInGlobalIndex(locator)) {
return fork->nHeight;
}
return std::nullopt;