Skip to content

Commit da94ebc

Browse files
committed
validation: move header validation error logging to VALIDATION debug category
1 parent 1d7d835 commit da94ebc

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/validation.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3205,7 +3205,7 @@ bool BlockManager::AcceptBlockHeader(const CBlockHeader& block, BlockValidationS
32053205
if (ppindex)
32063206
*ppindex = pindex;
32073207
if (pindex->nStatus & BLOCK_FAILED_MASK) {
3208-
LogPrintf("ERROR: %s: block %s is marked invalid\n", __func__, hash.ToString());
3208+
LogPrint(BCLog::VALIDATION, "%s: block %s is marked invalid\n", __func__, hash.ToString());
32093209
return state.Invalid(BlockValidationResult::BLOCK_CACHED_INVALID, "duplicate");
32103210
}
32113211
return true;
@@ -3220,16 +3220,18 @@ bool BlockManager::AcceptBlockHeader(const CBlockHeader& block, BlockValidationS
32203220
CBlockIndex* pindexPrev = nullptr;
32213221
BlockMap::iterator mi = m_block_index.find(block.hashPrevBlock);
32223222
if (mi == m_block_index.end()) {
3223-
LogPrintf("ERROR: %s: %s prev block not found\n", __func__, hash.ToString());
3223+
LogPrint(BCLog::VALIDATION, "%s: %s prev block not found\n", __func__, hash.ToString());
32243224
return state.Invalid(BlockValidationResult::BLOCK_MISSING_PREV, "prev-blk-not-found");
32253225
}
32263226
pindexPrev = (*mi).second;
32273227
if (pindexPrev->nStatus & BLOCK_FAILED_MASK) {
3228-
LogPrintf("ERROR: %s: %s prev block invalid\n", __func__, hash.ToString());
3228+
LogPrint(BCLog::VALIDATION, "%s: %s prev block invalid\n", __func__, hash.ToString());
32293229
return state.Invalid(BlockValidationResult::BLOCK_INVALID_PREV, "bad-prevblk");
32303230
}
3231-
if (!ContextualCheckBlockHeader(block, state, *this, chainparams, pindexPrev, GetAdjustedTime()))
3232-
return error("%s: Consensus::ContextualCheckBlockHeader: %s, %s", __func__, hash.ToString(), state.ToString());
3231+
if (!ContextualCheckBlockHeader(block, state, *this, chainparams, pindexPrev, GetAdjustedTime())) {
3232+
LogPrint(BCLog::VALIDATION, "%s: Consensus::ContextualCheckBlockHeader: %s, %s\n", __func__, hash.ToString(), state.ToString());
3233+
return false;
3234+
}
32333235

32343236
/* Determine if this block descends from any block which has been found
32353237
* invalid (m_failed_blocks), then mark pindexPrev and any blocks between
@@ -3264,7 +3266,7 @@ bool BlockManager::AcceptBlockHeader(const CBlockHeader& block, BlockValidationS
32643266
setDirtyBlockIndex.insert(invalid_walk);
32653267
invalid_walk = invalid_walk->pprev;
32663268
}
3267-
LogPrintf("ERROR: %s: %s prev block invalid\n", __func__, hash.ToString());
3269+
LogPrint(BCLog::VALIDATION, "%s: %s prev block invalid\n", __func__, hash.ToString());
32683270
return state.Invalid(BlockValidationResult::BLOCK_INVALID_PREV, "bad-prevblk");
32693271
}
32703272
}

0 commit comments

Comments
 (0)