MCPcopy Create free account
hub / github.com/ElementsProject/elements / CheckForkWarningConditions

Method CheckForkWarningConditions

src/validation.cpp:1617–1633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1615}
1616
1617void CChainState::CheckForkWarningConditions()
1618{
1619 AssertLockHeld(cs_main);
1620
1621 // Before we get past initial download, we cannot reliably alert about forks
1622 // (we assume we don't get stuck on a fork before finishing our initial sync)
1623 if (IsInitialBlockDownload()) {
1624 return;
1625 }
1626
1627 if (m_chainman.m_best_invalid && m_chainman.m_best_invalid->nChainWork > m_chain.Tip()->nChainWork + (GetBlockProof(*m_chain.Tip()) * 6)) {
1628 LogPrintf("%s: Warning: Found invalid chain at least ~6 blocks longer than our best chain.\nChain state database corruption likely.\n", __func__);
1629 SetfLargeWorkInvalidChainFound(true);
1630 } else {
1631 SetfLargeWorkInvalidChainFound(false);
1632 }
1633}
1634
1635// Called both upon regular invalid block discovery *and* InvalidateBlock
1636void CChainState::InvalidChainFound(CBlockIndex* pindexNew)

Callers

nothing calls this directly

Calls 3

GetBlockProofFunction · 0.85
TipMethod · 0.45

Tested by

no test coverage detected