Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 1,038 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, defer the check execution to the caller. | |||||
if (pvChecks) { | if (pvChecks) { | ||||
pvChecks->push_back(std::move(check)); | pvChecks->push_back(std::move(check)); | ||||
} else if (!check()) { | continue; | ||||
} | |||||
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))); | ||||
▲ Show 20 Lines • Show All 4,681 Lines • Show Last 20 Lines |