This is incorrect. The mere presence of an OP_SUCCESSx
opcode in a BIP 342 tapscript makes it automatically evaluate to true. Quoting BIP 342, emphasis mine:
The script as defined in BIP341 (i.e., the penultimate witness stack element after removing the optional annex) is called the tapscript and is decoded into opcodes, one by one:
- …
- If any opcode numbered 80, 98, 126-129, 131-134, 137-138, 141-142, 149-153, 187-254 is encountered, validation succeeds (none of the rules below apply). This is true even if later bytes in the tapscript would fail to decode otherwise. These opcodes are renamed to
OP_SUCCESS80
, …,OP_SUCCESS254
, and collectively known asOP_SUCCESSx
.- …
- The tapscript is executed according to the rules in the following section, with the initial stack as input.
I think the scheme works, but only if you split the branches into separate script leaves.