Does OP_EQUALVERIFY have a return value?

0

The Bitcoin wiki has a page that summarizes OP_EQUAL and OP_EQUALVERIFY:

OP_EQUAL

  • Opcode (Hex): 135 (0x87)
  • Input: x1 x2
  • Output: True / false
  • Summary: Returns 1 if the inputs are exactly equal, 0 otherwise.

OP_EQUALVERIFY

  • Opcode (Hex): 136 (0x88)
  • Input: x1 x2
  • Output: True / false
  • Summary: Same as OP_EQUAL, but runs OP_VERIFY afterward.

OP_EQUALVERIFY is listed as having a return code, when it doesn't seem like it should. (OP_EQUAL OP_VERIFY wouldn't leave anything on the stack.)

Nick ODell

Posted 2015-04-04T18:45:47.937

Reputation: 26 536

Answers

1

If the execution of OP_EQUAL gives true, then it does not leave true/false on the stack. If it is false then it leaves false on top of the stack and stops executing.

Bstack.push_back(fEqual ? vchTrue : vchFalse);
if (opcode == OP_EQUALVERIFY)
{
if (fEqual)
    popstack(stack);
else
    return set_error(serror, SCRIPT_ERR_EQUALVERIFY);
}

Source

morsecoder

Posted 2015-04-04T18:45:47.937

Reputation: 12 624

Is the Bitcoin wiki wrong on this one, then?Nick ODell 2015-04-04T19:30:00.290

1I would say so. I think it should be Nothing / False, just like OP_VERIFY.morsecoder 2015-04-04T19:35:26.967