aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-12-13 14:36:19 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2018-12-13 14:37:43 +0100
commit20c54eef6e41216a99b16bab2b5a7c0fb701f46e (patch)
tree4175c21bee7b395022025c2c03bf95eec4019acd
parent62c15471f12cd168f2c5b6722f911bee1a97ceb1 (diff)
parentfbaaf782cea54dc433e72129ee1088b3169cdfd4 (diff)
Merge #14834: validation: assert that pindexPrev is non-null when required
fbaaf782cea54dc433e72129ee1088b3169cdfd4 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
-rw-r--r--src/validation.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index e92cbf1b8d..5696684ed6 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -3267,6 +3267,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;
}