Changeset View
Changeset View
Standalone View
Standalone View
src/script/interpreter.cpp
Show First 20 Lines • Show All 1,630 Lines • ▼ Show 20 Lines | if ((flags & SCRIPT_VERIFY_P2SH) && scriptPubKey.IsPayToScriptHash()) { | ||||
// scriptPubKey would be evaluated with an empty stack and the | // scriptPubKey would be evaluated with an empty stack and the | ||||
// EvalScript above would return false. | // EvalScript above would return false. | ||||
assert(!stack.empty()); | assert(!stack.empty()); | ||||
const valtype &pubKeySerialized = stack.back(); | const valtype &pubKeySerialized = stack.back(); | ||||
CScript pubKey2(pubKeySerialized.begin(), pubKeySerialized.end()); | CScript pubKey2(pubKeySerialized.begin(), pubKeySerialized.end()); | ||||
popstack(stack); | popstack(stack); | ||||
// Bail out early if ALLOW_SEGWIT_RECOVERY is set, the redeem script is | |||||
// a p2sh segwit program and it was the only item pushed into the stack | |||||
if ((flags & SCRIPT_ALLOW_SEGWIT_RECOVERY) != 0 && stack.empty() && | |||||
pubKey2.IsWitnessProgram()) { | |||||
return set_success(serror); | |||||
} | |||||
if (!EvalScript(stack, pubKey2, flags, checker, serror)) { | if (!EvalScript(stack, pubKey2, flags, checker, serror)) { | ||||
// serror is set | // serror is set | ||||
return false; | return false; | ||||
} | } | ||||
if (stack.empty()) { | if (stack.empty()) { | ||||
return set_error(serror, SCRIPT_ERR_EVAL_FALSE); | return set_error(serror, SCRIPT_ERR_EVAL_FALSE); | ||||
} | } | ||||
if (!CastToBool(stack.back())) { | if (!CastToBool(stack.back())) { | ||||
Show All 20 Lines |