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

Method CheckForkWarningConditions

src/validation.cpp:1951–1967  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1949}
1950
1951void Chainstate::CheckForkWarningConditions()
1952{
1953 AssertLockHeld(cs_main);
1954
1955 if (this->GetRole().historical) {
1956 return;
1957 }
1958
1959 if (m_chainman.m_best_invalid && m_chainman.m_best_invalid->nChainWork > m_chain.Tip()->nChainWork + (GetBlockProof(*m_chain.Tip()) * 6)) {
1960 LogWarning("Found invalid chain more than 6 blocks longer than our best chain. This could be due to database corruption or consensus incompatibility with peers.");
1961 m_chainman.GetNotifications().warningSet(
1962 kernel::Warning::LARGE_WORK_INVALID_CHAIN,
1963 _("Warning: Found invalid chain more than 6 blocks longer than our best chain. This could be due to database corruption or consensus incompatibility with peers."));
1964 } else {
1965 m_chainman.GetNotifications().warningUnset(kernel::Warning::LARGE_WORK_INVALID_CHAIN);
1966 }
1967}
1968
1969// Called both upon regular invalid block discovery *and* InvalidateBlock
1970void Chainstate::InvalidChainFound(CBlockIndex* pindexNew)

Callers

nothing calls this directly

Calls 6

GetRoleMethod · 0.95
GetBlockProofFunction · 0.85
_Function · 0.85
TipMethod · 0.45
warningSetMethod · 0.45
warningUnsetMethod · 0.45

Tested by

no test coverage detected