From 839f1fa4ea2a29e983a8c93b8a0ac65fc76ba741 Mon Sep 17 00:00:00 2001 From: Pedro Pinheiro Date: Wed, 24 Feb 2016 18:36:33 +0000 Subject: [PATCH] Add assertion Enforce the invariant that the existence of an end-of-grace-period implies the existence of an activation hash. --- src/rpcblockchain.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 1c6d25cdf28..aa547266f2c 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -618,7 +618,9 @@ static UniValue HardForkMajorityDesc(int minVersion, CBlockIndex* pindex, int nR // Always report blocks found as over the threshold once the fork is active nFound = nRequired + 1; gracePeriodEnds = static_cast(forkTime); - triggeredAtBlock = pblocktree->ForkBitActivated(FORK_BIT_2MB).GetHex(); + uint256 activationHash = pblocktree->ForkBitActivated(FORK_BIT_2MB); + assert(activationHash != uint256()); + triggeredAtBlock = activationHash.GetHex(); } else { for (int i = 0; i < consensusParams.nMajorityWindow && pstart != NULL; i++) {