mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-18 16:01:00 +02:00
Merge bitcoin/bitcoin#22428: [Refactor] Rename scriptPubKey -> exec_script
007910388b54abc97057e44a7a8f7241e83c203b [Refactor] Rename scriptPubKey -> exec_script (sanket1729)
Pull request description:
Rename scriptPubKey to witness_script in ExecuteWitnessScript() function to correctly reflect which script is being executed.
For example in segwitv0, this scriptPubKey refers to the script of the form `OP_0 <script_hash>`, but witness_script refers to the script that actually hashes to the `script_hash`.
If there is a reason why it's named this way, I would love to know
ACKs for top commit:
MarcoFalke:
review ACK 007910388b54abc97057e44a7a8f7241e83c203b 🖖
theStack:
ACK 007910388b54abc97057e44a7a8f7241e83c203b
lsilva01:
Code Review 007910388b
ACK
Tree-SHA512: 768e10e656b60b1293beb560fb7adbc2c1495e6db1f54f0c2c63109692ae0c579c856b194b33f72afd0d332159a9796c0e2bd99b79ea5c4b1803469a81301fd6
This commit is contained in:
commit
a3791da0e8
@ -1807,16 +1807,16 @@ bool GenericTransactionSignatureChecker<T>::CheckSequence(const CScriptNum& nSeq
|
|||||||
template class GenericTransactionSignatureChecker<CTransaction>;
|
template class GenericTransactionSignatureChecker<CTransaction>;
|
||||||
template class GenericTransactionSignatureChecker<CMutableTransaction>;
|
template class GenericTransactionSignatureChecker<CMutableTransaction>;
|
||||||
|
|
||||||
static bool ExecuteWitnessScript(const Span<const valtype>& stack_span, const CScript& scriptPubKey, unsigned int flags, SigVersion sigversion, const BaseSignatureChecker& checker, ScriptExecutionData& execdata, ScriptError* serror)
|
static bool ExecuteWitnessScript(const Span<const valtype>& stack_span, const CScript& exec_script, unsigned int flags, SigVersion sigversion, const BaseSignatureChecker& checker, ScriptExecutionData& execdata, ScriptError* serror)
|
||||||
{
|
{
|
||||||
std::vector<valtype> stack{stack_span.begin(), stack_span.end()};
|
std::vector<valtype> stack{stack_span.begin(), stack_span.end()};
|
||||||
|
|
||||||
if (sigversion == SigVersion::TAPSCRIPT) {
|
if (sigversion == SigVersion::TAPSCRIPT) {
|
||||||
// OP_SUCCESSx processing overrides everything, including stack element size limits
|
// OP_SUCCESSx processing overrides everything, including stack element size limits
|
||||||
CScript::const_iterator pc = scriptPubKey.begin();
|
CScript::const_iterator pc = exec_script.begin();
|
||||||
while (pc < scriptPubKey.end()) {
|
while (pc < exec_script.end()) {
|
||||||
opcodetype opcode;
|
opcodetype opcode;
|
||||||
if (!scriptPubKey.GetOp(pc, opcode)) {
|
if (!exec_script.GetOp(pc, opcode)) {
|
||||||
// Note how this condition would not be reached if an unknown OP_SUCCESSx was found
|
// Note how this condition would not be reached if an unknown OP_SUCCESSx was found
|
||||||
return set_error(serror, SCRIPT_ERR_BAD_OPCODE);
|
return set_error(serror, SCRIPT_ERR_BAD_OPCODE);
|
||||||
}
|
}
|
||||||
@ -1839,7 +1839,7 @@ static bool ExecuteWitnessScript(const Span<const valtype>& stack_span, const CS
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run the script interpreter.
|
// Run the script interpreter.
|
||||||
if (!EvalScript(stack, scriptPubKey, flags, checker, sigversion, execdata, serror)) return false;
|
if (!EvalScript(stack, exec_script, flags, checker, sigversion, execdata, serror)) return false;
|
||||||
|
|
||||||
// Scripts inside witness implicitly require cleanstack behaviour
|
// Scripts inside witness implicitly require cleanstack behaviour
|
||||||
if (stack.size() != 1) return set_error(serror, SCRIPT_ERR_CLEANSTACK);
|
if (stack.size() != 1) return set_error(serror, SCRIPT_ERR_CLEANSTACK);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user