mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01:00
p2p: Add warning message when receiving headers for blocks cached as invalid
Currently, if database corruption leads to a block being marked as invalid incorrectly, we can get stuck in an infinite headerssync loop with no indication what went wrong or how to fix it. With the added log message, users will receive an explicit warning after each failed headerssync attempt with an outbound peer.
This commit is contained in:
@@ -4244,7 +4244,8 @@ bool ChainstateManager::AcceptBlockHeader(const CBlockHeader& block, BlockValida
|
||||
*ppindex = pindex;
|
||||
if (pindex->nStatus & BLOCK_FAILED_MASK) {
|
||||
LogDebug(BCLog::VALIDATION, "%s: block %s is marked invalid\n", __func__, hash.ToString());
|
||||
return state.Invalid(BlockValidationResult::BLOCK_CACHED_INVALID, "duplicate-invalid");
|
||||
return state.Invalid(BlockValidationResult::BLOCK_CACHED_INVALID, "duplicate-invalid",
|
||||
strprintf("block %s was previously marked invalid", hash.ToString()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user