Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 1,916 Lines • ▼ Show 20 Lines | const CBlockIndex *pindexLast = nullptr; | ||||
} | } | ||||
} | } | ||||
CValidationState state; | CValidationState state; | ||||
CBlockHeader first_invalid_header; | CBlockHeader first_invalid_header; | ||||
if (!ProcessNewBlockHeaders(config, headers, state, &pindexLast, | if (!ProcessNewBlockHeaders(config, headers, state, &pindexLast, | ||||
&first_invalid_header)) { | &first_invalid_header)) { | ||||
if (state.IsInvalid()) { | if (state.IsInvalid()) { | ||||
// The lock is required here due to LookupBlockIndex | |||||
LOCK(cs_main); | |||||
if (punish_duplicate_invalid && | if (punish_duplicate_invalid && | ||||
LookupBlockIndex(first_invalid_header.GetHash())) { | state.GetReason() == ValidationInvalidReason::CACHED_INVALID) { | ||||
// Goal: don't allow outbound peers to use up our outbound | // Goal: don't allow outbound peers to use up our outbound | ||||
// connection slots if they are on incompatible chains. | // connection slots if they are on incompatible chains. | ||||
// | // | ||||
// We ask the caller to set punish_invalid appropriately based | // We ask the caller to set punish_invalid appropriately based | ||||
// on the peer and the method of header delivery (compact blocks | // on the peer and the method of header delivery (compact blocks | ||||
// are allowed to be invalid in some circumstances, under BIP | // are allowed to be invalid in some circumstances, under BIP | ||||
// 152). | // 152). | ||||
// Here, we try to detect the narrow situation that we have a | // Here, we try to detect the narrow situation that we have a | ||||
▲ Show 20 Lines • Show All 3,145 Lines • Show Last 20 Lines |