[refactor] Add deploymentstatus.h

Provides DeploymentEnabled, DeploymentActiveAt, and DeploymentActiveAfter
helpers for checking the status of buried deployments. Can be overloaded
so the same syntax works for non-buried deployments, allowing future
soft forks to be changed from signalled to buried deployments without
having to touch the implementation code.

Replaces IsWitnessEnabled and IsScriptWitnessEnabled.
This commit is contained in:
Anthony Towns
2020-06-16 18:58:56 +10:00
parent eccd736f3d
commit 2b0d291da8
9 changed files with 101 additions and 53 deletions

View File

@@ -10,6 +10,7 @@
#include <consensus/params.h>
#include <consensus/validation.h>
#include <core_io.h>
#include <deploymentstatus.h>
#include <key_io.h>
#include <miner.h>
#include <net.h>
@@ -774,7 +775,7 @@ static RPCHelpMan getblocktemplate()
pblock->nNonce = 0;
// NOTE: If at some point we support pre-segwit miners post-segwit-activation, this needs to take segwit support into consideration
const bool fPreSegWit = (pindexPrev->nHeight + 1 < consensusParams.SegwitHeight);
const bool fPreSegWit = !DeploymentActiveAfter(pindexPrev, consensusParams, Consensus::DEPLOYMENT_SEGWIT);
UniValue aCaps(UniValue::VARR); aCaps.push_back("proposal");