Fix 11-year-old mis-categorized error code in OP_IF evaluation

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.

Also in this commit:

- Fix script_tests to adjust to the corrected error message
- Fix p2p_invalid_tx functional test to produce the desired error message
This commit is contained in:
Calin Culianu
2025-03-26 08:12:39 -05:00
parent c0b7159de4
commit a7b581423e
3 changed files with 14 additions and 14 deletions

View File

@@ -607,7 +607,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) {