Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: luv2drnkbr on August 17, 2016, 10:03:42 AM



Title: Quick stupid question on OP_NOTIF
Post by: luv2drnkbr on August 17, 2016, 10:03:42 AM
Can OP_NOTIF begin an if/else block?  That is, is the following code valid:

Code:
<true / false stack item>
OP_NOTIF
    <some script to be executed>
OP_ENDIF

Or does an if/else block need to always begin with an OP_IF?

I assume I am correct that you can begin with OP_NOTIF, and that the above script code is valid, but I wanted to double check.


Title: Re: Quick stupid question on OP_NOTIF
Post by: achow101 on August 17, 2016, 12:51:23 PM
That is correct, you can begin the block with OP_NOTIF.


Title: Re: Quick stupid question on OP_NOTIF
Post by: luv2drnkbr on August 19, 2016, 08:53:49 AM
Thanks.  It would be cleaner to use OP_IF, but it saves redeemscript space to use NOTIF, and for Bitcoin I figure saving space is the way to go.