mirror of https://github.com/bitcoin/bitcoin.git
validation: call CheckForkWarningConditions during IBD, and at startup
The existing IBD check was added at a time when CheckForkWarningConditions did also sophisticated fork detection that could lead to false positives during IBD (55ed3f1475
). The fork detection logic doesn't exist anymore (sincefa62304c97
), so the IBD check is no longer necessary. Displaying the log at startup will help node operators diagnose the problem better.
This commit is contained in:
parent
419ff388b9
commit
04b943b63c
|
@ -2026,15 +2026,12 @@ void Chainstate::CheckForkWarningConditions()
|
||||||
{
|
{
|
||||||
AssertLockHeld(cs_main);
|
AssertLockHeld(cs_main);
|
||||||
|
|
||||||
// Before we get past initial download, we cannot reliably alert about forks
|
if (this->GetRole() == ChainstateRole::BACKGROUND) {
|
||||||
// (we assume we don't get stuck on a fork before finishing our initial sync)
|
|
||||||
// Also not applicable to the background chainstate
|
|
||||||
if (m_chainman.IsInitialBlockDownload() || this->GetRole() == ChainstateRole::BACKGROUND) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_chainman.m_best_invalid && m_chainman.m_best_invalid->nChainWork > m_chain.Tip()->nChainWork + (GetBlockProof(*m_chain.Tip()) * 6)) {
|
if (m_chainman.m_best_invalid && m_chainman.m_best_invalid->nChainWork > m_chain.Tip()->nChainWork + (GetBlockProof(*m_chain.Tip()) * 6)) {
|
||||||
LogPrintf("%s: Warning: Found invalid chain at least ~6 blocks longer than our best chain.\nChain state database corruption likely.\n", __func__);
|
LogWarning("Found invalid chain at least ~6 blocks longer than our best chain. Chain state database corruption likely.");
|
||||||
m_chainman.GetNotifications().warningSet(
|
m_chainman.GetNotifications().warningSet(
|
||||||
kernel::Warning::LARGE_WORK_INVALID_CHAIN,
|
kernel::Warning::LARGE_WORK_INVALID_CHAIN,
|
||||||
_("Warning: We do not appear to fully agree with our peers! You may need to upgrade, or other nodes may need to upgrade."));
|
_("Warning: We do not appear to fully agree with our peers! You may need to upgrade, or other nodes may need to upgrade."));
|
||||||
|
@ -4677,6 +4674,8 @@ bool Chainstate::LoadChainTip()
|
||||||
/*verification_progress=*/m_chainman.GuessVerificationProgress(tip));
|
/*verification_progress=*/m_chainman.GuessVerificationProgress(tip));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CheckForkWarningConditions();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue