LookupBlockIndex -> CACHED_INVALID

Co-authored-by: Anthony Towns <aj@erisian.com.au>
This commit is contained in:
Matt Corallo 2019-01-17 14:33:16 +10:00 committed by Suhas Daftuar
parent c8b0d22698
commit 7df16e70e6

View file

@ -1578,7 +1578,7 @@ bool static ProcessHeadersMessage(CNode *pfrom, CConnman *connman, const std::ve
CBlockHeader first_invalid_header; CBlockHeader first_invalid_header;
if (!ProcessNewBlockHeaders(headers, state, chainparams, &pindexLast, &first_invalid_header)) { if (!ProcessNewBlockHeaders(headers, state, chainparams, &pindexLast, &first_invalid_header)) {
if (state.IsInvalid()) { if (state.IsInvalid()) {
if (punish_duplicate_invalid && LookupBlockIndex(first_invalid_header.GetHash())) { if (punish_duplicate_invalid && 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.
// //