Add assertion

Enforce the invariant that the existence of an end-of-grace-period
implies the existence of an activation hash.
This commit is contained in:
Pedro Pinheiro
2016-02-24 18:36:33 +00:00
parent 296236412f
commit 839f1fa4ea

View File

@@ -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<uint64_t>(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++)
{