| 6273 | } |
| 6274 | |
| 6275 | void ChainstateManager::RecalculateBestHeader() |
| 6276 | { |
| 6277 | AssertLockHeld(cs_main); |
| 6278 | m_best_header = ActiveChain().Tip(); |
| 6279 | for (auto& entry : m_blockman.m_block_index) { |
| 6280 | if (!(entry.second.nStatus & BLOCK_FAILED_VALID) && m_best_header->nChainWork < entry.second.nChainWork) { |
| 6281 | m_best_header = &entry.second; |
| 6282 | } |
| 6283 | } |
| 6284 | } |
| 6285 | |
| 6286 | std::optional<int> ChainstateManager::BlocksAheadOfTip() const |
| 6287 | { |