Skip to content

Commit 9ab2a04

Browse files
TheBlueMattajtowns
authored andcommitted
CorruptionPossible -> BLOCK_MUTATED
Co-authored-by: Anthony Towns <[email protected]>
1 parent 6e55b29 commit 9ab2a04

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/blockencodings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ ReadStatus PartiallyDownloadedBlock::FillBlock(CBlock& block, const std::vector<
203203
// but that is expensive, and CheckBlock caches a block's
204204
// "checked-status" (in the CBlock?). CBlock should be able to
205205
// check its own merkle root and cache that check.
206-
if (state.CorruptionPossible())
206+
if (state.GetReason() == ValidationInvalidReason::BLOCK_MUTATED)
207207
return READ_STATUS_FAILED; // Possible Short ID collision
208208
return READ_STATUS_CHECKBLOCK_FAILED;
209209
}

src/validation.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,7 @@ void static InvalidChainFound(CBlockIndex* pindexNew) EXCLUSIVE_LOCKS_REQUIRED(c
12901290
}
12911291

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

35103510
if (!CheckBlock(block, state, chainparams.GetConsensus()) ||
35113511
!ContextualCheckBlock(block, state, chainparams.GetConsensus(), pindex->pprev)) {
3512-
if (state.IsInvalid() && !state.CorruptionPossible()) {
3512+
if (state.IsInvalid() && state.GetReason() != ValidationInvalidReason::BLOCK_MUTATED) {
35133513
pindex->nStatus |= BLOCK_FAILED_VALID;
35143514
setDirtyBlockIndex.insert(pindex);
35153515
}

0 commit comments

Comments
 (0)