validation: call RecalculateBestHeader in InvalidChainFound

This means that it is being called in two situations:
1.) As part of the invalidateblock rpc
2.) When we receive a block for which we have a valid
header in our block index, but the block turns out to be invalid
This commit is contained in:
Martin Zumsande
2024-08-14 17:28:55 -04:00
parent 9275e9689a
commit 783cb7337f
2 changed files with 3 additions and 1 deletions

View File

@@ -2046,7 +2046,7 @@ void Chainstate::InvalidChainFound(CBlockIndex* pindexNew)
m_chainman.m_best_invalid = pindexNew;
}
if (m_chainman.m_best_header != nullptr && m_chainman.m_best_header->GetAncestor(pindexNew->nHeight) == pindexNew) {
m_chainman.m_best_header = m_chain.Tip();
m_chainman.RecalculateBestHeader();
}
LogPrintf("%s: invalid block=%s height=%d log2_work=%f date=%s\n", __func__,