Bitcoin Forum
April 25, 2024, 01:01:39 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: OP_VERIF & OP_VERNOTIF opcodes  (Read 1715 times)
oleganza (OP)
Full Member
***
Offline Offline

Activity: 200
Merit: 104


Software design and user experience.


View Profile WWW
August 13, 2013, 06: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?


Bitcoin analytics: blog.oleganza.com / 1TipsuQ7CSqfQsjA9KU5jarSB1AnrVLLo
1714006899
Hero Member
*
Offline Offline

Posts: 1714006899

View Profile Personal Message (Offline)

Ignore
1714006899
Reply with quote  #2

1714006899
Report to moderator
"Your bitcoin is secured in a way that is physically impossible for others to access, no matter for what reason, no matter how good the excuse, no matter a majority of miners, no matter what." -- Greg Maxwell
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714006899
Hero Member
*
Offline Offline

Posts: 1714006899

View Profile Personal Message (Offline)

Ignore
1714006899
Reply with quote  #2

1714006899
Report to moderator
1714006899
Hero Member
*
Offline Offline

Posts: 1714006899

View Profile Personal Message (Offline)

Ignore
1714006899
Reply with quote  #2

1714006899
Report to moderator
1714006899
Hero Member
*
Offline Offline

Posts: 1714006899

View Profile Personal Message (Offline)

Ignore
1714006899
Reply with quote  #2

1714006899
Report to moderator
oleganza (OP)
Full Member
***
Offline Offline

Activity: 200
Merit: 104


Software design and user experience.


View Profile WWW
August 18, 2013, 12:29:38 PM
 #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

Bitcoin analytics: blog.oleganza.com / 1TipsuQ7CSqfQsjA9KU5jarSB1AnrVLLo
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!