diff options
author | Suhas Daftuar <sdaftuar@chaincode.com> | 2017-09-12 12:40:29 -0400 |
---|---|---|
committer | Suhas Daftuar <sdaftuar@gmail.com> | 2018-04-13 10:35:27 -0400 |
commit | 95749a58364611c997ba9295fb27489e0d7b1d42 (patch) | |
tree | e9c254385c6abd27c1ff919d385f614a236d4beb /src/validation.cpp | |
parent | ce650182f4d9847423202789856e6e5f499151f8 (diff) |
Separate NULLDUMMY enforcement from SEGWIT enforcement
This is in preparation for enforcing SCRIPT_VERIFY_WITNESS from
the genesis block.
Diffstat (limited to 'src/validation.cpp')
-rw-r--r-- | src/validation.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index ac585895e5..6bcc03c305 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1760,6 +1760,9 @@ static unsigned int GetBlockScriptFlags(const CBlockIndex* pindex, const Consens // Start enforcing WITNESS rules using versionbits logic. if (IsWitnessEnabled(pindex->pprev, consensusparams)) { flags |= SCRIPT_VERIFY_WITNESS; + } + + if (IsNullDummyEnabled(pindex->pprev, consensusparams)) { flags |= SCRIPT_VERIFY_NULLDUMMY; } @@ -3106,6 +3109,12 @@ bool IsWitnessEnabled(const CBlockIndex* pindexPrev, const Consensus::Params& pa return (VersionBitsState(pindexPrev, params, Consensus::DEPLOYMENT_SEGWIT, versionbitscache) == ThresholdState::ACTIVE); } +bool IsNullDummyEnabled(const CBlockIndex* pindexPrev, const Consensus::Params& params) +{ + LOCK(cs_main); + return (VersionBitsState(pindexPrev, params, Consensus::DEPLOYMENT_SEGWIT, versionbitscache) == ThresholdState::ACTIVE); +} + // Compute at which vout of the block's coinbase transaction the witness // commitment occurs, or -1 if not found. static int GetWitnessCommitmentIndex(const CBlock& block) |