index: refactor-only: Reuse CChain ref

This commit is contained in:
Carl Dong 2021-05-07 14:50:10 -04:00
parent db33cde80f
commit 7a799c9c2b

View file

@ -60,12 +60,12 @@ bool BaseIndex::Init()
} }
LOCK(cs_main); LOCK(cs_main);
CChain& active_chain = m_chainstate->m_chain;
if (locator.IsNull()) { if (locator.IsNull()) {
m_best_block_index = nullptr; m_best_block_index = nullptr;
} else { } else {
m_best_block_index = m_chainstate->m_blockman.FindForkInGlobalIndex(m_chainstate->m_chain, locator); m_best_block_index = m_chainstate->m_blockman.FindForkInGlobalIndex(active_chain, locator);
} }
CChain& active_chain = m_chainstate->m_chain;
m_synced = m_best_block_index.load() == active_chain.Tip(); m_synced = m_best_block_index.load() == active_chain.Tip();
if (!m_synced) { if (!m_synced) {
bool prune_violation = false; bool prune_violation = false;