Changeset View
Changeset View
Standalone View
Standalone View
src/script/interpreter.cpp
Show First 20 Lines • Show All 1,629 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 | // Bail out early if SCRIPT_DISALLOW_SEGWIT_RECOVERY is not set, the | ||||
// a p2sh segwit program and it was the only item pushed into the stack | // redeem script is a p2sh segwit program, and it was the only item | ||||
if ((flags & SCRIPT_ALLOW_SEGWIT_RECOVERY) != 0 && stack.empty() && | // pushed onto the stack. | ||||
if ((flags & SCRIPT_DISALLOW_SEGWIT_RECOVERY) == 0 && stack.empty() && | |||||
deadalnix: Why is this checking for the stack to be empty ? | |||||
markblundebergUnsubmitted Not Done Inline ActionsThis is a consensus rule now. Do not change this. markblundeberg: This is a consensus rule now. Do not change this. | |||||
markblundebergUnsubmitted Not Done Inline Actions(the stack.empty I mean) markblundeberg: (the stack.empty I mean) | |||||
MengerianAuthorUnsubmitted Done Inline ActionsIDK, but my understanding is that changing that would break consensus. It would mean you could do segwit recoveries with extra unnecessary pushes, which new ABC would accept and old ABC would reject. Mengerian: IDK, but my understanding is that changing that would break consensus.
It would mean you could… | |||||
pubKey2.IsWitnessProgram()) { | pubKey2.IsWitnessProgram()) { | ||||
return set_success(serror); | 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; | ||||
} | } | ||||
Show All 24 Lines |
Why is this checking for the stack to be empty ?