Author

Topic: OP_VERIF & OP_VERNOTIF opcodes (Read 1715 times)

full member
Activity: 200
Merit: 104
Software design and user experience.
August 18, 2013, 07:29:38 AM
#2
Now I know why OP_VERIF and OP_VERNOTIF fail the transaction even if "not executed".

BitcoinQT walks though all operators from OP_IF to OP_ENDIF inside "non-executed" branch to keep track of nesting.
Since OP_VERIF and OP_VERNOTIF are not assigned, even inside a non-executed branch they will fall in "default:" switch case and cause the script to fail. Some other ops like OP_VER can be present inside non-executed branch because they'll be skipped.

Code:
    OP_IF       = 0x63, 
    OP_NOTIF    = 0x64,
    OP_VERIF    = 0x65, // Not assigned.
    OP_VERNOTIF = 0x66, // Not assigned.
    OP_ELSE     = 0x67,
    OP_ENDIF    = 0x68
full member
Activity: 200
Merit: 104
Software design and user experience.
August 13, 2013, 01:27:29 PM
#1
I don't understand why the wiki says (https://en.bitcoin.it/wiki/Script):

OP_VERIF (0x65) Transaction is invalid even when occuring in an unexecuted OP_IF branch
OP_VERNOTIF (0x66) Transaction is invalid even when occuring in an unexecuted OP_IF branch

From the BitcoinQT code I see that OP_VERIF and OP_VERNOTIF are undefined in the same way as OP_VER or OP_RESERVED. Meaning, if OP_VER is skipped in the if branch, then OP_VERIF is skipped as well.

But the wiki says that tx will be valid if OP_VER is not executed, but will be invalid even if OP_VERIF is not executed. Is it a mistake in the wiki or I miss something here?

Jump to: