Separate NULLDUMMY enforcement from SEGWIT enforcement
This is in preparation for enforcing SCRIPT_VERIFY_WITNESS from the genesis block.
This commit is contained in:
parent
ce650182f4
commit
95749a5836
2 changed files with 12 additions and 0 deletions
|
@ -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)
|
||||
|
|
|
@ -411,6 +411,9 @@ bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams,
|
|||
/** Check whether witness commitments are required for block. */
|
||||
bool IsWitnessEnabled(const CBlockIndex* pindexPrev, const Consensus::Params& params);
|
||||
|
||||
/** Check whether NULLDUMMY (BIP 147) has activated. */
|
||||
bool IsNullDummyEnabled(const CBlockIndex* pindexPrev, const Consensus::Params& params);
|
||||
|
||||
/** When there are blocks in the active chain with missing data, rewind the chainstate and remove them from the block index */
|
||||
bool RewindBlockIndex(const CChainParams& params);
|
||||
|
||||
|
|
Loading…
Reference in a new issue