Skip to content

Commit 20c54ee

Browse files
committed
Merge #14834: validation: assert that pindexPrev is non-null when required
fbaaf78 validation: assert that pindexPrev is non-null when required (Karl-Johan Alm) Pull request description: In `ContextualCheckBlock`, we are checking if `pindexPrev == nullptr` conditionally at the start, but then assume it is non-`null` later. This removes the latter assumption. Tree-SHA512: 95f1e9dc839b2cc0e099d155e6180634ece8c6760d00b53e7d27128762e64c92e82d98a5f4a5786b48a4851b17cdbb4b667d3b6a99adb651256e2032de67d05c
2 parents 62c1547 + fbaaf78 commit 20c54ee

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/validation.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3267,6 +3267,7 @@ static bool ContextualCheckBlock(const CBlock& block, CValidationState& state, c
32673267
// Start enforcing BIP113 (Median Time Past) using versionbits logic.
32683268
int nLockTimeFlags = 0;
32693269
if (VersionBitsState(pindexPrev, consensusParams, Consensus::DEPLOYMENT_CSV, versionbitscache) == ThresholdState::ACTIVE) {
3270+
assert(pindexPrev != nullptr);
32703271
nLockTimeFlags |= LOCKTIME_MEDIAN_TIME_PAST;
32713272
}
32723273

0 commit comments

Comments
 (0)