MCPcopy Create free account
hub / github.com/Bitcoin-ABC/bitcoin-abc / GetNextBlockScriptFlags

Function GetNextBlockScriptFlags

src/validation.cpp:2049–2117  ·  view source on GitHub ↗

Returns the script flags which should be checked for the block after the given block.

Source from the content-addressed store, hash-verified

2047// Returns the script flags which should be checked for the block after
2048// the given block.
2049static uint32_t GetNextBlockScriptFlags(const CBlockIndex *pindex,
2050 const ChainstateManager &chainman) {
2051 const Consensus::Params &consensusparams = chainman.GetConsensus();
2052
2053 uint32_t flags = SCRIPT_VERIFY_NONE;
2054
2055 // Enforce P2SH (BIP16)
2056 if (DeploymentActiveAfter(pindex, chainman, Consensus::DEPLOYMENT_P2SH)) {
2057 flags |= SCRIPT_VERIFY_P2SH;
2058 }
2059
2060 // Enforce the DERSIG (BIP66) rule.
2061 if (DeploymentActiveAfter(pindex, chainman, Consensus::DEPLOYMENT_DERSIG)) {
2062 flags |= SCRIPT_VERIFY_DERSIG;
2063 }
2064
2065 // Start enforcing CHECKLOCKTIMEVERIFY (BIP65) rule.
2066 if (DeploymentActiveAfter(pindex, chainman, Consensus::DEPLOYMENT_CLTV)) {
2067 flags |= SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY;
2068 }
2069
2070 // Start enforcing CSV (BIP68, BIP112 and BIP113) rule.
2071 if (DeploymentActiveAfter(pindex, chainman, Consensus::DEPLOYMENT_CSV)) {
2072 flags |= SCRIPT_VERIFY_CHECKSEQUENCEVERIFY;
2073 }
2074
2075 // If the UAHF is enabled, we start accepting replay protected txns
2076 if (IsUAHFenabled(consensusparams, pindex)) {
2077 flags |= SCRIPT_VERIFY_STRICTENC;
2078 flags |= SCRIPT_ENABLE_SIGHASH_FORKID;
2079 }
2080
2081 // If the DAA HF is enabled, we start rejecting transaction that use a high
2082 // s in their signature. We also make sure that signature that are supposed
2083 // to fail (for instance in multisig or other forms of smart contracts) are
2084 // null.
2085 if (IsDAAEnabled(consensusparams, pindex)) {
2086 flags |= SCRIPT_VERIFY_LOW_S;
2087 flags |= SCRIPT_VERIFY_NULLFAIL;
2088 }
2089
2090 // When the magnetic anomaly fork is enabled, we start accepting
2091 // transactions using the OP_CHECKDATASIG opcode and it's verify
2092 // alternative. We also start enforcing push only signatures and
2093 // clean stack.
2094 if (IsMagneticAnomalyEnabled(consensusparams, pindex)) {
2095 flags |= SCRIPT_VERIFY_SIGPUSHONLY;
2096 flags |= SCRIPT_VERIFY_CLEANSTACK;
2097 }
2098
2099 if (IsGravitonEnabled(consensusparams, pindex)) {
2100 flags |= SCRIPT_ENABLE_SCHNORR_MULTISIG;
2101 flags |= SCRIPT_VERIFY_MINIMALDATA;
2102 }
2103
2104 if (IsPhononEnabled(consensusparams, pindex)) {
2105 flags |= SCRIPT_ENFORCE_SIGCHECKS;
2106 }

Callers 5

ConnectBlockMethod · 0.85
DisconnectTipMethod · 0.85
ConnectTipMethod · 0.85

Calls 7

IsUAHFenabledFunction · 0.85
IsDAAEnabledFunction · 0.85
IsMagneticAnomalyEnabledFunction · 0.85
IsGravitonEnabledFunction · 0.85
IsPhononEnabledFunction · 0.85
DeploymentActiveAfterFunction · 0.70

Tested by

no test coverage detected