Changeset View
Changeset View
Standalone View
Standalone View
src/script/interpreter.cpp
Show First 20 Lines • Show All 1,686 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
// explicit instantiation | // explicit instantiation | ||||
template class GenericTransactionSignatureChecker<CTransaction>; | template class GenericTransactionSignatureChecker<CTransaction>; | ||||
template class GenericTransactionSignatureChecker<CMutableTransaction>; | template class GenericTransactionSignatureChecker<CMutableTransaction>; | ||||
bool VerifyScript(const CScript &scriptSig, const CScript &scriptPubKey, | bool VerifyScript(const CScript &scriptSig, const CScript &scriptPubKey, | ||||
uint32_t flags, const BaseSignatureChecker &checker, | uint32_t flags, const BaseSignatureChecker &checker, | ||||
ScriptError *serror) { | ScriptExecutionMetrics &metrics, ScriptError *serror) { | ||||
set_error(serror, ScriptError::UNKNOWN); | set_error(serror, ScriptError::UNKNOWN); | ||||
// If FORKID is enabled, we also ensure strict encoding. | // If FORKID is enabled, we also ensure strict encoding. | ||||
if (flags & SCRIPT_ENABLE_SIGHASH_FORKID) { | if (flags & SCRIPT_ENABLE_SIGHASH_FORKID) { | ||||
flags |= SCRIPT_VERIFY_STRICTENC; | flags |= SCRIPT_VERIFY_STRICTENC; | ||||
} | } | ||||
if ((flags & SCRIPT_VERIFY_SIGPUSHONLY) != 0 && !scriptSig.IsPushOnly()) { | if ((flags & SCRIPT_VERIFY_SIGPUSHONLY) != 0 && !scriptSig.IsPushOnly()) { | ||||
return set_error(serror, ScriptError::SIG_PUSHONLY); | return set_error(serror, ScriptError::SIG_PUSHONLY); | ||||
} | } | ||||
ScriptExecutionMetrics metrics; | // to be sure, zero out the metrics since we check the input-accumulated | ||||
// value below | |||||
metrics = {}; | |||||
std::vector<valtype> stack, stackCopy; | std::vector<valtype> stack, stackCopy; | ||||
if (!EvalScript(stack, scriptSig, flags, checker, metrics, serror)) { | if (!EvalScript(stack, scriptSig, flags, checker, metrics, serror)) { | ||||
// serror is set | // serror is set | ||||
return false; | return false; | ||||
} | } | ||||
if (flags & SCRIPT_VERIFY_P2SH) { | if (flags & SCRIPT_VERIFY_P2SH) { | ||||
stackCopy = stack; | stackCopy = stack; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines |