mirror of https://github.com/bitcoin/bitcoin.git
Merge 6ae9af6b98
into b510893d00
This commit is contained in:
commit
9c867a6cdc
|
@ -2956,6 +2956,10 @@ void PeerManagerImpl::ProcessHeadersMessage(CNode& pfrom, Peer& peer,
|
||||||
state, &pindexLast)};
|
state, &pindexLast)};
|
||||||
if (!processed) {
|
if (!processed) {
|
||||||
if (state.IsInvalid()) {
|
if (state.IsInvalid()) {
|
||||||
|
if (state.GetResult() == BlockValidationResult::BLOCK_CACHED_INVALID) {
|
||||||
|
LogWarning("Received header for a block previously marked as invalid from peer=%d. "
|
||||||
|
"If this happens with all peers, database corruption is likely and -reindex may be necessary to recover.", pfrom.GetId());
|
||||||
|
}
|
||||||
MaybePunishNodeForBlock(pfrom.GetId(), state, via_compact_block, "invalid header received");
|
MaybePunishNodeForBlock(pfrom.GetId(), state, via_compact_block, "invalid header received");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2023,15 +2023,13 @@ void Chainstate::CheckForkWarningConditions()
|
||||||
{
|
{
|
||||||
AssertLockHeld(cs_main);
|
AssertLockHeld(cs_main);
|
||||||
|
|
||||||
// Before we get past initial download, we cannot reliably alert about forks
|
// Not applicable to the background chainstate
|
||||||
// (we assume we don't get stuck on a fork before finishing our initial sync)
|
if (this->GetRole() == ChainstateRole::BACKGROUND) {
|
||||||
// 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."));
|
||||||
|
@ -4674,6 +4672,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