Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 719 Lines • ▼ Show 20 Lines | for (const CTxIn &txin : tx.vin) { | ||||
if (IsGreatWallEnabledForCurrentBlock(config)) { | if (IsGreatWallEnabledForCurrentBlock(config)) { | ||||
if (!fRequireStandard) { | if (!fRequireStandard) { | ||||
extraFlags |= SCRIPT_ALLOW_SEGWIT_RECOVERY; | extraFlags |= SCRIPT_ALLOW_SEGWIT_RECOVERY; | ||||
} | } | ||||
extraFlags |= SCRIPT_ENABLE_SCHNORR; | extraFlags |= SCRIPT_ENABLE_SCHNORR; | ||||
} | } | ||||
// Check inputs based on the set of flags we activate. | |||||
uint32_t scriptVerifyFlags = STANDARD_SCRIPT_VERIFY_FLAGS; | |||||
if (!config.GetChainParams().RequireStandard()) { | |||||
scriptVerifyFlags = | |||||
SCRIPT_ENABLE_SIGHASH_FORKID | | |||||
gArgs.GetArg("-promiscuousmempoolflags", scriptVerifyFlags); | |||||
} | |||||
// Make sure whatever we need to activate is actually activated. | // Make sure whatever we need to activate is actually activated. | ||||
scriptVerifyFlags |= extraFlags; | const uint32_t scriptVerifyFlags = | ||||
STANDARD_SCRIPT_VERIFY_FLAGS | 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)) { | ||||
// State filled in by CheckInputs. | // State filled in by CheckInputs. | ||||
return false; | return false; | ||||
Show All 15 Lines | for (const CTxIn &txin : tx.vin) { | ||||
// invalid blocks (using TestBlockValidity), however allowing such | // invalid blocks (using TestBlockValidity), however allowing such | ||||
// transactions into the mempool can be exploited as a DoS attack. | // transactions into the mempool can be exploited as a DoS attack. | ||||
uint32_t currentBlockScriptVerifyFlags = | uint32_t currentBlockScriptVerifyFlags = | ||||
GetBlockScriptFlags(config, chainActive.Tip()); | GetBlockScriptFlags(config, chainActive.Tip()); | ||||
if (!CheckInputsFromMempoolAndCache(tx, state, view, pool, | if (!CheckInputsFromMempoolAndCache(tx, state, view, pool, | ||||
currentBlockScriptVerifyFlags, true, | currentBlockScriptVerifyFlags, true, | ||||
txdata)) { | txdata)) { | ||||
// If we're using promiscuousmempoolflags, we may hit this normally. | return error("%s: BUG! PLEASE REPORT THIS! CheckInputs failed " | ||||
// Check if current block has some flags that scriptVerifyFlags does | "against latest-block but not STANDARD flags %s, %s", | ||||
// not before printing an ominous warning. | |||||
if (!(~scriptVerifyFlags & currentBlockScriptVerifyFlags)) { | |||||
return error( | |||||
"%s: BUG! PLEASE REPORT THIS! ConnectInputs failed against " | |||||
"MANDATORY but not STANDARD flags %s, %s", | |||||
__func__, txid.ToString(), FormatStateMessage(state)); | __func__, txid.ToString(), FormatStateMessage(state)); | ||||
} | } | ||||
if (!CheckInputs(tx, state, view, true, | |||||
MANDATORY_SCRIPT_VERIFY_FLAGS | extraFlags, true, | |||||
false, txdata)) { | |||||
return error( | |||||
"%s: ConnectInputs failed against MANDATORY but not " | |||||
"STANDARD flags due to promiscuous mempool %s, %s", | |||||
__func__, txid.ToString(), FormatStateMessage(state)); | |||||
} | |||||
LogPrintf("Warning: -promiscuousmempool flags set to not include " | |||||
"currently enforced soft forks, this may break mining or " | |||||
"otherwise cause instability!\n"); | |||||
} | |||||
if (test_accept) { | if (test_accept) { | ||||
// Tx was accepted, but not added | // Tx was accepted, but not added | ||||
return true; | return true; | ||||
} | } | ||||
// Store transaction in memory. | // Store transaction in memory. | ||||
pool.addUnchecked(txid, entry, setAncestors); | pool.addUnchecked(txid, entry, setAncestors); | ||||
▲ Show 20 Lines • Show All 4,934 Lines • Show Last 20 Lines |