Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 1,402 Lines • ▼ Show 20 Lines | for (size_t i = 0; i < tx.vin.size(); i++) { | ||||
pvChecks->push_back(std::move(check)); | pvChecks->push_back(std::move(check)); | ||||
} else if (!check()) { | } else if (!check()) { | ||||
if (flags & STANDARD_NOT_MANDATORY_VERIFY_FLAGS) { | if (flags & STANDARD_NOT_MANDATORY_VERIFY_FLAGS) { | ||||
// Check whether the failure was caused by a non-mandatory | // Check whether the failure was caused by a non-mandatory | ||||
// script verification check, such as non-standard DER encodings | // script verification check, such as non-standard DER encodings | ||||
// or non-null dummy arguments; if so, don't trigger DoS | // or non-null dummy arguments; if so, don't trigger DoS | ||||
// protection to avoid splitting the network between upgraded | // protection to avoid splitting the network between upgraded | ||||
// and non-upgraded nodes. | // and non-upgraded nodes. | ||||
uint32_t mandatoryFlags = | |||||
flags & ~STANDARD_NOT_MANDATORY_VERIFY_FLAGS; | |||||
CScriptCheck check2(scriptPubKey, amount, tx, i, | CScriptCheck check2(scriptPubKey, amount, tx, i, | ||||
flags & | mandatoryFlags & | ||||
~STANDARD_NOT_MANDATORY_VERIFY_FLAGS, | ~SCRIPT_ENABLE_SIGHASH_FORKID, | ||||
cacheStore, txdata); | cacheStore, txdata); | ||||
if (check2()) { | // We also need to check with and without the forkid flag. | ||||
freetrader: It would be nice to add some more rationale to this comment, like what is written in the… | |||||
CScriptCheck check3(scriptPubKey, amount, tx, i, | |||||
mandatoryFlags | | |||||
SCRIPT_ENABLE_SIGHASH_FORKID, | |||||
cacheStore, txdata); | |||||
if (check2() || check3()) { | |||||
return state.Invalid( | return state.Invalid( | ||||
false, REJECT_NONSTANDARD, | false, REJECT_NONSTANDARD, | ||||
strprintf("non-mandatory-script-verify-flag (%s)", | strprintf("non-mandatory-script-verify-flag (%s)", | ||||
ScriptErrorString(check.GetScriptError()))); | ScriptErrorString(check.GetScriptError()))); | ||||
} | } | ||||
} | } | ||||
// Failures of other flags indicate a transaction that is invalid in | // Failures of other flags indicate a transaction that is invalid in | ||||
▲ Show 20 Lines • Show All 3,578 Lines • Show Last 20 Lines |
It would be nice to add some more rationale to this comment, like what is written in the summary. Without it, it's difficult to understand why this code is here.
And it would make more sense to me if this comment was moved to before check2 instantiational, or to right before if if() conditional. I prefer higher up though.