Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 1,062 Lines • ▼ Show 20 Lines | for (size_t i = 0; i < tx.vin.size(); i++) { | ||||
// clearly committed to by tx's hash. This provides a sanity | // clearly committed to by tx's hash. This provides a sanity | ||||
// check that our caching is not introducing consensus failures through | // check that our caching is not introducing consensus failures through | ||||
// additional data in, eg, the coins being spent being checked as a part | // additional data in, eg, the coins being spent being checked as a part | ||||
// of CScriptCheck. | // of CScriptCheck. | ||||
// Verify signature | // Verify signature | ||||
CScriptCheck check(coin.GetTxOut(), tx, i, flags, sigCacheStore, txdata, | CScriptCheck check(coin.GetTxOut(), tx, i, flags, sigCacheStore, txdata, | ||||
&txLimitSigChecks, pBlockLimitSigChecks); | &txLimitSigChecks, pBlockLimitSigChecks); | ||||
// If pvChecks is not null, move the input check and skip running it. | |||||
// The sigcheck count will not be added to the total. | |||||
deadalnix: The sigcheck will definitively be counted. his comment is at best misleading. | |||||
if (pvChecks) { | if (pvChecks) { | ||||
pvChecks->push_back(std::move(check)); | pvChecks->push_back(std::move(check)); | ||||
} else if (!check()) { | continue; | ||||
} | |||||
// If pvChecks is null, run the check; if it fails, try to figure why. | |||||
deadalnixUnsubmitted Not Done Inline ActionsAnyone who ends up here can read the code. Repeating the code in English doesn't help. There is a reason WHY the code is structured this way. This is what you need to explain. deadalnix: Anyone who ends up here can read the code. Repeating the code in English doesn't help. There is… | |||||
if (!check()) { | |||||
ScriptError scriptError = check.GetScriptError(); | ScriptError scriptError = check.GetScriptError(); | ||||
// Compute flags without the optional standardness flags. | // Compute flags without the optional standardness flags. | ||||
// This differs from MANDATORY_SCRIPT_VERIFY_FLAGS as it contains | // This differs from MANDATORY_SCRIPT_VERIFY_FLAGS as it contains | ||||
// additional upgrade flags (see AcceptToMemoryPoolWorker variable | // additional upgrade flags (see AcceptToMemoryPoolWorker variable | ||||
// extraFlags). | // extraFlags). | ||||
uint32_t mandatoryFlags = | uint32_t mandatoryFlags = | ||||
flags & ~STANDARD_NOT_MANDATORY_VERIFY_FLAGS; | flags & ~STANDARD_NOT_MANDATORY_VERIFY_FLAGS; | ||||
if (flags != mandatoryFlags) { | if (flags != mandatoryFlags) { | ||||
Show All 10 Lines | for (size_t i = 0; i < tx.vin.size(); i++) { | ||||
strprintf("non-mandatory-script-verify-flag (%s)", | strprintf("non-mandatory-script-verify-flag (%s)", | ||||
ScriptErrorString(scriptError))); | ScriptErrorString(scriptError))); | ||||
} | } | ||||
// update the error message to reflect the mandatory violation. | // update the error message to reflect the mandatory violation. | ||||
scriptError = check2.GetScriptError(); | scriptError = check2.GetScriptError(); | ||||
} | } | ||||
// MANDATORY flag failures correspond to | // MANDATORY flag failures correspond to | ||||
// TxValidationResult::TX_CONSENSUS. Because CONSENSUS failures | // TxValidationResult::TX_CONSENSUS. Because CONSENSUS failures are | ||||
// are the most serious case of validation failures, we may need to | // the most serious case of validation failures, we may need to | ||||
// consider using RECENT_CONSENSUS_CHANGE for any script failure | // consider using RECENT_CONSENSUS_CHANGE for any script failure | ||||
// that could be due to non-upgraded nodes which we may want to | // that could be due to non-upgraded nodes which we may want to | ||||
// support, to avoid splitting the network (but this depends on the | // support, to avoid splitting the network (but this depends on the | ||||
// details of how net_processing handles such errors). | // details of how net_processing handles such errors). | ||||
return state.Invalid( | return state.Invalid( | ||||
TxValidationResult::TX_CONSENSUS, REJECT_INVALID, | TxValidationResult::TX_CONSENSUS, REJECT_INVALID, | ||||
strprintf("mandatory-script-verify-flag-failed (%s)", | strprintf("mandatory-script-verify-flag-failed (%s)", | ||||
ScriptErrorString(scriptError))); | ScriptErrorString(scriptError))); | ||||
} | } | ||||
// We reached this point if pvChecks is null and the check succeeded for | |||||
// this input; add its sigcheck count to the total. | |||||
nSigChecksTotal += check.GetScriptExecutionMetrics().nSigChecks; | nSigChecksTotal += check.GetScriptExecutionMetrics().nSigChecks; | ||||
} | } | ||||
nSigChecksOut = nSigChecksTotal; | nSigChecksOut = nSigChecksTotal; | ||||
if (scriptCacheStore && !pvChecks) { | if (scriptCacheStore && !pvChecks) { | ||||
// We executed all of the provided scripts, and were told to cache the | // We executed all of the provided scripts, and were told to cache the | ||||
// result. Do so now. | // result. Do so now. | ||||
▲ Show 20 Lines • Show All 4,687 Lines • Show Last 20 Lines |
The sigcheck will definitively be counted. his comment is at best misleading.