mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-05-17 23:56:39 +00:00
validation: move header validation error logging to VALIDATION debug category
This commit is contained in:
parent
1d7d835ec3
commit
da94ebc2fa
@ -3205,7 +3205,7 @@ bool BlockManager::AcceptBlockHeader(const CBlockHeader& block, BlockValidationS
|
|||||||
if (ppindex)
|
if (ppindex)
|
||||||
*ppindex = pindex;
|
*ppindex = pindex;
|
||||||
if (pindex->nStatus & BLOCK_FAILED_MASK) {
|
if (pindex->nStatus & BLOCK_FAILED_MASK) {
|
||||||
LogPrintf("ERROR: %s: block %s is marked invalid\n", __func__, hash.ToString());
|
LogPrint(BCLog::VALIDATION, "%s: block %s is marked invalid\n", __func__, hash.ToString());
|
||||||
return state.Invalid(BlockValidationResult::BLOCK_CACHED_INVALID, "duplicate");
|
return state.Invalid(BlockValidationResult::BLOCK_CACHED_INVALID, "duplicate");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -3220,16 +3220,18 @@ bool BlockManager::AcceptBlockHeader(const CBlockHeader& block, BlockValidationS
|
|||||||
CBlockIndex* pindexPrev = nullptr;
|
CBlockIndex* pindexPrev = nullptr;
|
||||||
BlockMap::iterator mi = m_block_index.find(block.hashPrevBlock);
|
BlockMap::iterator mi = m_block_index.find(block.hashPrevBlock);
|
||||||
if (mi == m_block_index.end()) {
|
if (mi == m_block_index.end()) {
|
||||||
LogPrintf("ERROR: %s: %s prev block not found\n", __func__, hash.ToString());
|
LogPrint(BCLog::VALIDATION, "%s: %s prev block not found\n", __func__, hash.ToString());
|
||||||
return state.Invalid(BlockValidationResult::BLOCK_MISSING_PREV, "prev-blk-not-found");
|
return state.Invalid(BlockValidationResult::BLOCK_MISSING_PREV, "prev-blk-not-found");
|
||||||
}
|
}
|
||||||
pindexPrev = (*mi).second;
|
pindexPrev = (*mi).second;
|
||||||
if (pindexPrev->nStatus & BLOCK_FAILED_MASK) {
|
if (pindexPrev->nStatus & BLOCK_FAILED_MASK) {
|
||||||
LogPrintf("ERROR: %s: %s prev block invalid\n", __func__, hash.ToString());
|
LogPrint(BCLog::VALIDATION, "%s: %s prev block invalid\n", __func__, hash.ToString());
|
||||||
return state.Invalid(BlockValidationResult::BLOCK_INVALID_PREV, "bad-prevblk");
|
return state.Invalid(BlockValidationResult::BLOCK_INVALID_PREV, "bad-prevblk");
|
||||||
}
|
}
|
||||||
if (!ContextualCheckBlockHeader(block, state, *this, chainparams, pindexPrev, GetAdjustedTime()))
|
if (!ContextualCheckBlockHeader(block, state, *this, chainparams, pindexPrev, GetAdjustedTime())) {
|
||||||
return error("%s: Consensus::ContextualCheckBlockHeader: %s, %s", __func__, hash.ToString(), state.ToString());
|
LogPrint(BCLog::VALIDATION, "%s: Consensus::ContextualCheckBlockHeader: %s, %s\n", __func__, hash.ToString(), state.ToString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* Determine if this block descends from any block which has been found
|
/* Determine if this block descends from any block which has been found
|
||||||
* invalid (m_failed_blocks), then mark pindexPrev and any blocks between
|
* invalid (m_failed_blocks), then mark pindexPrev and any blocks between
|
||||||
@ -3264,7 +3266,7 @@ bool BlockManager::AcceptBlockHeader(const CBlockHeader& block, BlockValidationS
|
|||||||
setDirtyBlockIndex.insert(invalid_walk);
|
setDirtyBlockIndex.insert(invalid_walk);
|
||||||
invalid_walk = invalid_walk->pprev;
|
invalid_walk = invalid_walk->pprev;
|
||||||
}
|
}
|
||||||
LogPrintf("ERROR: %s: %s prev block invalid\n", __func__, hash.ToString());
|
LogPrint(BCLog::VALIDATION, "%s: %s prev block invalid\n", __func__, hash.ToString());
|
||||||
return state.Invalid(BlockValidationResult::BLOCK_INVALID_PREV, "bad-prevblk");
|
return state.Invalid(BlockValidationResult::BLOCK_INVALID_PREV, "bad-prevblk");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user