Changeset View
Changeset View
Standalone View
Standalone View
src/script/interpreter.cpp
Show First 20 Lines • Show All 1,744 Lines • ▼ Show 20 Lines | if ((flags & SCRIPT_VERIFY_P2SH) && scriptPubKey.IsPayToScriptHash()) { | ||||
popstack(stack); | popstack(stack); | ||||
// Bail out early if SCRIPT_DISALLOW_SEGWIT_RECOVERY is not set, the | // Bail out early if SCRIPT_DISALLOW_SEGWIT_RECOVERY is not set, the | ||||
// redeem script is a p2sh segwit program, and it was the only item | // redeem script is a p2sh segwit program, and it was the only item | ||||
// pushed onto the stack. | // pushed onto the stack. | ||||
if ((flags & SCRIPT_DISALLOW_SEGWIT_RECOVERY) == 0 && stack.empty() && | if ((flags & SCRIPT_DISALLOW_SEGWIT_RECOVERY) == 0 && stack.empty() && | ||||
pubKey2.IsWitnessProgram()) { | pubKey2.IsWitnessProgram()) { | ||||
// must set metricsOut for all successful returns | // must set metricsOut for all successful returns | ||||
// Prior to activation of this flag, all transactions will count as | |||||
// having a sigchecks count of 0 for accounting purposes outside of | |||||
// VerifyScript. | |||||
if (!(flags & SCRIPT_REPORT_SIGCHECKS)) { | |||||
metrics.nSigChecks = 0; | |||||
} | |||||
metricsOut = metrics; | metricsOut = metrics; | ||||
return set_success(serror); | return set_success(serror); | ||||
} | } | ||||
if (!EvalScript(stack, pubKey2, flags, checker, metrics, serror)) { | if (!EvalScript(stack, pubKey2, flags, checker, metrics, serror)) { | ||||
// serror is set | // serror is set | ||||
return false; | return false; | ||||
} | } | ||||
Show All 38 Lines | if (flags & SCRIPT_VERIFY_INPUT_SIGCHECKS) { | ||||
static_assert(INT_MAX / 43 / 3 > MAX_OPS_PER_SCRIPT, | static_assert(INT_MAX / 43 / 3 > MAX_OPS_PER_SCRIPT, | ||||
"overflow sanity check on maximum possible sigchecks " | "overflow sanity check on maximum possible sigchecks " | ||||
"from sig+redeem+pub scripts"); | "from sig+redeem+pub scripts"); | ||||
if (int(scriptSig.size()) < metrics.nSigChecks * 43 - 60) { | if (int(scriptSig.size()) < metrics.nSigChecks * 43 - 60) { | ||||
return set_error(serror, ScriptError::INPUT_SIGCHECKS); | return set_error(serror, ScriptError::INPUT_SIGCHECKS); | ||||
} | } | ||||
} | } | ||||
// Prior to activation of this flag, all transactions will count as having a | |||||
// sigchecks count of 0 for accounting purposes outside of VerifyScript. | |||||
if (!(flags & SCRIPT_REPORT_SIGCHECKS)) { | |||||
metrics.nSigChecks = 0; | |||||
} | |||||
metricsOut = metrics; | metricsOut = metrics; | ||||
return set_success(serror); | return set_success(serror); | ||||
} | } |