Skip to content

Commit

Permalink
Merge bitcoin#14834: validation: assert that pindexPrev is non-null w…
Browse files Browse the repository at this point in the history
…hen 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
  • Loading branch information
laanwj authored and PastaPastaPasta committed Jul 1, 2021
1 parent bfc582d commit b080b6e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/validation.cpp
Expand Up @@ -3757,6 +3757,7 @@ static bool ContextualCheckBlock(const CBlock& block, CValidationState& state, c
// Start enforcing BIP113 (Median Time Past) using versionbits logic.
int nLockTimeFlags = 0;
if (VersionBitsState(pindexPrev, consensusParams, Consensus::DEPLOYMENT_CSV, versionbitscache) == ThresholdState::ACTIVE) {
assert(pindexPrev != nullptr);
nLockTimeFlags |= LOCKTIME_MEDIAN_TIME_PAST;
}

Expand Down

0 comments on commit b080b6e

Please sign in to comment.