MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / RecalculateBestHeader

Method RecalculateBestHeader

src/validation.cpp:6275–6284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6273}
6274
6275void 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
6286std::optional<int> ChainstateManager::BlocksAheadOfTip() const
6287{

Callers 3

InvalidChainFoundMethod · 0.80
BOOST_FIXTURE_TEST_CASEFunction · 0.80
ReconsiderBlockFunction · 0.80

Calls 1

TipMethod · 0.45

Tested by 1

BOOST_FIXTURE_TEST_CASEFunction · 0.64