Allow testing ChainLocks enforcement with spork19 == 1 (#2854)

This is only for testnet.
This commit is contained in:
Alexander Block 2019-04-11 14:41:51 +02:00 committed by UdjinM6
parent e67618ac5c
commit 82a47f5432

View File

@ -214,12 +214,13 @@ void CChainLocksHandler::CheckActiveState()
LOCK(cs);
bool oldIsEnforced = isEnforced;
isSporkActive = sporkManager.IsSporkActive(SPORK_19_CHAINLOCKS_ENABLED);
isEnforced = fDIP0008Active && isSporkActive;
// TODO remove this after DIP8 is active
bool fEnforcedBySpork = (Params().NetworkIDString() == CBaseChainParams::TESTNET) && (sporkManager.GetSporkValue(SPORK_19_CHAINLOCKS_ENABLED) == 1);
isEnforced = (fDIP0008Active && isSporkActive) || fEnforcedBySpork;
if (!oldIsEnforced && isEnforced) {
// ChainLocks got activated just recently, but it's possible that it was already running before, leaving
// us with some stale values which we should not try to enforce anymore (there probably was a good reason to
// us with some stale values which we should not try to enforce anymore (there probably was a good reason
// to disable spork19)
bestChainLockHash = uint256();
bestChainLock = bestChainLockWithKnownBlock = CChainLockSig();