Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 715 Lines • ▼ Show 20 Lines | for (const CTxIn &txin : tx.vin) { | ||||
extraFlags |= SCRIPT_ENABLE_REPLAY_PROTECTION; | extraFlags |= SCRIPT_ENABLE_REPLAY_PROTECTION; | ||||
} | } | ||||
if (IsMagneticAnomalyEnabledForCurrentBlock(config)) { | if (IsMagneticAnomalyEnabledForCurrentBlock(config)) { | ||||
extraFlags |= SCRIPT_ENABLE_CHECKDATASIG; | extraFlags |= SCRIPT_ENABLE_CHECKDATASIG; | ||||
} | } | ||||
if (IsGreatWallEnabledForCurrentBlock(config)) { | if (IsGreatWallEnabledForCurrentBlock(config)) { | ||||
if (!fRequireStandard) { | |||||
extraFlags |= SCRIPT_ALLOW_SEGWIT_RECOVERY; | |||||
} | |||||
extraFlags |= SCRIPT_ENABLE_SCHNORR; | extraFlags |= SCRIPT_ENABLE_SCHNORR; | ||||
} | } | ||||
// Check inputs based on the set of flags we activate. | // Check inputs based on the set of flags we activate. | ||||
uint32_t scriptVerifyFlags = STANDARD_SCRIPT_VERIFY_FLAGS; | uint32_t scriptVerifyFlags = STANDARD_SCRIPT_VERIFY_FLAGS; | ||||
if (!config.GetChainParams().RequireStandard()) { | if (!config.GetChainParams().RequireStandard()) { | ||||
scriptVerifyFlags = | scriptVerifyFlags = | ||||
SCRIPT_ENABLE_SIGHASH_FORKID | | SCRIPT_ENABLE_SIGHASH_FORKID | | ||||
gArgs.GetArg("-promiscuousmempoolflags", scriptVerifyFlags); | gArgs.GetArg("-promiscuousmempoolflags", scriptVerifyFlags); | ||||
} | } | ||||
if (!fRequireStandard) { | |||||
scriptVerifyFlags |= SCRIPT_ALLOW_SEGWIT_RECOVERY; | |||||
deadalnix: Add these to extraFlags. This is important or the error reporting will not be correct. | |||||
} | |||||
// Make sure whatever we need to activate is actually activated. | // Make sure whatever we need to activate is actually activated. | ||||
scriptVerifyFlags |= extraFlags; | scriptVerifyFlags |= extraFlags; | ||||
// Check against previous transactions. This is done last to help | // Check against previous transactions. This is done last to help | ||||
// prevent CPU exhaustion denial-of-service attacks. | // prevent CPU exhaustion denial-of-service attacks. | ||||
PrecomputedTransactionData txdata(tx); | PrecomputedTransactionData txdata(tx); | ||||
if (!CheckInputs(tx, state, view, true, scriptVerifyFlags, true, false, | if (!CheckInputs(tx, state, view, true, scriptVerifyFlags, true, false, | ||||
txdata)) { | txdata)) { | ||||
Show All 28 Lines | for (const CTxIn &txin : tx.vin) { | ||||
if (!(~scriptVerifyFlags & currentBlockScriptVerifyFlags)) { | if (!(~scriptVerifyFlags & currentBlockScriptVerifyFlags)) { | ||||
return error( | return error( | ||||
"%s: BUG! PLEASE REPORT THIS! ConnectInputs failed against " | "%s: BUG! PLEASE REPORT THIS! ConnectInputs failed against " | ||||
"MANDATORY but not STANDARD flags %s, %s", | "MANDATORY but not STANDARD flags %s, %s", | ||||
__func__, txid.ToString(), FormatStateMessage(state)); | __func__, txid.ToString(), FormatStateMessage(state)); | ||||
} | } | ||||
if (!CheckInputs(tx, state, view, true, | if (!CheckInputs(tx, state, view, true, | ||||
MANDATORY_SCRIPT_VERIFY_FLAGS | extraFlags, true, | MANDATORY_SCRIPT_VERIFY_FLAGS | extraFlags, true, | ||||
deadalnixUnsubmitted Not Done Inline ActionsSee here. deadalnix: See here. | |||||
false, txdata)) { | false, txdata)) { | ||||
return error( | return error( | ||||
"%s: ConnectInputs failed against MANDATORY but not " | "%s: ConnectInputs failed against MANDATORY but not " | ||||
"STANDARD flags due to promiscuous mempool %s, %s", | "STANDARD flags due to promiscuous mempool %s, %s", | ||||
__func__, txid.ToString(), FormatStateMessage(state)); | __func__, txid.ToString(), FormatStateMessage(state)); | ||||
} | } | ||||
LogPrintf("Warning: -promiscuousmempool flags set to not include " | LogPrintf("Warning: -promiscuousmempool flags set to not include " | ||||
▲ Show 20 Lines • Show All 843 Lines • ▼ Show 20 Lines | |||||
// Returns the script flags which should be checked for a given block | // Returns the script flags which should be checked for a given block | ||||
static uint32_t GetBlockScriptFlags(const Config &config, | static uint32_t GetBlockScriptFlags(const Config &config, | ||||
const CBlockIndex *pChainTip) { | const CBlockIndex *pChainTip) { | ||||
AssertLockHeld(cs_main); | AssertLockHeld(cs_main); | ||||
const Consensus::Params &consensusParams = | const Consensus::Params &consensusParams = | ||||
config.GetChainParams().GetConsensus(); | config.GetChainParams().GetConsensus(); | ||||
uint32_t flags = SCRIPT_VERIFY_NONE; | uint32_t flags = SCRIPT_VERIFY_NONE | SCRIPT_ALLOW_SEGWIT_RECOVERY; | ||||
// P2SH didn't become active until Apr 1 2012 | // P2SH didn't become active until Apr 1 2012 | ||||
if (pChainTip->GetMedianTimePast() >= P2SH_ACTIVATION_TIME) { | if (pChainTip->GetMedianTimePast() >= P2SH_ACTIVATION_TIME) { | ||||
flags |= SCRIPT_VERIFY_P2SH; | flags |= SCRIPT_VERIFY_P2SH; | ||||
} | } | ||||
// Start enforcing the DERSIG (BIP66) rule. | // Start enforcing the DERSIG (BIP66) rule. | ||||
if ((pChainTip->nHeight + 1) >= consensusParams.BIP66Height) { | if ((pChainTip->nHeight + 1) >= consensusParams.BIP66Height) { | ||||
Show All 30 Lines | static uint32_t GetBlockScriptFlags(const Config &config, | ||||
// alternative. We also start enforcing push only signatures and | // alternative. We also start enforcing push only signatures and | ||||
// clean stack. | // clean stack. | ||||
if (IsMagneticAnomalyEnabled(config, pChainTip)) { | if (IsMagneticAnomalyEnabled(config, pChainTip)) { | ||||
flags |= SCRIPT_ENABLE_CHECKDATASIG; | flags |= SCRIPT_ENABLE_CHECKDATASIG; | ||||
flags |= SCRIPT_VERIFY_SIGPUSHONLY; | flags |= SCRIPT_VERIFY_SIGPUSHONLY; | ||||
flags |= SCRIPT_VERIFY_CLEANSTACK; | flags |= SCRIPT_VERIFY_CLEANSTACK; | ||||
} | } | ||||
// If the Great Wall fork is enabled, we start accepting transactions | // If the Great Wall fork is enabled, we start accepting 65/64-byte Schnorr | ||||
// recovering coins sent to segwit addresses. We also start accepting | // signatures in CHECKSIG and CHECKDATASIG respectively, and their verify | ||||
// 65/64-byte Schnorr signatures in CHECKSIG and CHECKDATASIG respectively, | // variants. We also stop accepting 65 byte signatures in CHECKMULTISIG and | ||||
// and their verify variants. We also stop accepting 65 byte signatures in | // its verify variant. | ||||
// CHECKMULTISIG and its verify variant. | |||||
if (IsGreatWallEnabled(config, pChainTip)) { | if (IsGreatWallEnabled(config, pChainTip)) { | ||||
flags |= SCRIPT_ALLOW_SEGWIT_RECOVERY; | |||||
flags |= SCRIPT_ENABLE_SCHNORR; | flags |= SCRIPT_ENABLE_SCHNORR; | ||||
} | } | ||||
// We make sure this node will have replay protection during the next hard | // We make sure this node will have replay protection during the next hard | ||||
// fork. | // fork. | ||||
if (IsReplayProtectionEnabled(config, pChainTip)) { | if (IsReplayProtectionEnabled(config, pChainTip)) { | ||||
flags |= SCRIPT_ENABLE_REPLAY_PROTECTION; | flags |= SCRIPT_ENABLE_REPLAY_PROTECTION; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 4,031 Lines • Show Last 20 Lines |
Add these to extraFlags. This is important or the error reporting will not be correct.