|
|
|
@ -1290,7 +1290,7 @@ void static InvalidChainFound(CBlockIndex* pindexNew) EXCLUSIVE_LOCKS_REQUIRED(c
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CChainState::InvalidBlockFound(CBlockIndex *pindex, const CValidationState &state) {
|
|
|
|
|
if (!state.CorruptionPossible()) {
|
|
|
|
|
if (state.GetReason() != ValidationInvalidReason::BLOCK_MUTATED) {
|
|
|
|
|
pindex->nStatus |= BLOCK_FAILED_VALID;
|
|
|
|
|
m_failed_blocks.insert(pindex);
|
|
|
|
|
setDirtyBlockIndex.insert(pindex);
|
|
|
|
@ -1791,7 +1791,7 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
|
|
|
|
|
// re-enforce that rule here (at least until we make it impossible for
|
|
|
|
|
// GetAdjustedTime() to go backward).
|
|
|
|
|
if (!CheckBlock(block, state, chainparams.GetConsensus(), !fJustCheck, !fJustCheck)) {
|
|
|
|
|
if (state.CorruptionPossible()) {
|
|
|
|
|
if (state.GetReason() == ValidationInvalidReason::BLOCK_MUTATED) {
|
|
|
|
|
// We don't write down blocks to disk if they may have been
|
|
|
|
|
// corrupted, so this should be impossible unless we're having hardware
|
|
|
|
|
// problems.
|
|
|
|
@ -2570,7 +2570,7 @@ bool CChainState::ActivateBestChainStep(CValidationState& state, const CChainPar
|
|
|
|
|
if (!ConnectTip(state, chainparams, pindexConnect, pindexConnect == pindexMostWork ? pblock : std::shared_ptr<const CBlock>(), connectTrace, disconnectpool)) {
|
|
|
|
|
if (state.IsInvalid()) {
|
|
|
|
|
// The block violates a consensus rule.
|
|
|
|
|
if (!state.CorruptionPossible()) {
|
|
|
|
|
if (state.GetReason() != ValidationInvalidReason::BLOCK_MUTATED) {
|
|
|
|
|
InvalidChainFound(vpindexToConnect.front());
|
|
|
|
|
}
|
|
|
|
|
state = CValidationState();
|
|
|
|
@ -3509,7 +3509,7 @@ bool CChainState::AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CVali
|
|
|
|
|
|
|
|
|
|
if (!CheckBlock(block, state, chainparams.GetConsensus()) ||
|
|
|
|
|
!ContextualCheckBlock(block, state, chainparams.GetConsensus(), pindex->pprev)) {
|
|
|
|
|
if (state.IsInvalid() && !state.CorruptionPossible()) {
|
|
|
|
|
if (state.IsInvalid() && state.GetReason() != ValidationInvalidReason::BLOCK_MUTATED) {
|
|
|
|
|
pindex->nStatus |= BLOCK_FAILED_VALID;
|
|
|
|
|
setDirtyBlockIndex.insert(pindex);
|
|
|
|
|
}
|
|
|
|
|