Merge bitcoin/bitcoin#32143: Fix 11-year-old mis-categorized error code in OP_IF evaluation

a7b581423e Fix 11-year-old mis-categorized error code in OP_IF evaluation (Calin Culianu)

Pull request description:

  This was introduced by commit ab9edbd6b6.

  It appears the original author may have gotten tired and pasted the wrong error code into this 1 place. Every other situation where the value stack lacks the required number of arguments for the op-code, SCRIPT_ERR_INVALID_STACK_OPERATION is reported. Not so here.

  This commit fixes the situation.

  EDIT: Note this turns out to be a dupe of the abandoned #30359 .

ACKs for top commit:
  billymcbip:
    tACK a7b581423e
  achow101:
    ACK a7b581423e
  darosior:
    utACK a7b581423e
  sedited:
    ACK a7b581423e

Tree-SHA512: e8c01a3e2448b5d49b76a0cab3f38a2d0249b71beeb7d9d05d5ecc3812bd91d0bd1d0f78b809b6f4ccb73186fa119cb1ed3779a73284b83a67ae219ef378fa6c
This commit is contained in:
Ava Chow
2026-01-19 16:39:45 -08:00
3 changed files with 14 additions and 14 deletions

View File

@@ -608,7 +608,7 @@ bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript&
if (fExec)
{
if (stack.size() < 1)
return set_error(serror, SCRIPT_ERR_UNBALANCED_CONDITIONAL);
return set_error(serror, SCRIPT_ERR_INVALID_STACK_OPERATION);
valtype& vch = stacktop(-1);
// Tapscript requires minimal IF/NOTIF inputs as a consensus rule.
if (sigversion == SigVersion::TAPSCRIPT) {