New BIP: Dealing with OP_IF and OP_NOTIF malleability in P2WSH



Summary:

A new BIP has been prepared to deal with OP_IF and OP_NOTIF malleability in P2WSH. The proposed changes apply only to pay-to-witness-script-hash (P2WSH) scripts described in BIP141, which has not been activated on the Bitcoin mainnet as of writing. To ensure OP_IF and OP_NOTIF transactions created before the introduction of this BIP will still be accepted by the network, the new rules are not applied to non-segregated witness scripts. In P2WSH, the argument for OP_IF and OP_NOTIF MUST be exactly an empty vector or 0x01, or the script evaluation fails immediately. This is a softfork on top of BIP141. The rules are enforced as a relay policy by the reference client since the first release of BIP141 (v0.13.1). The compatibility issue can arise if your script uses the combination of "OP_SIZE OP_IF" or "OP_DEPTH OP_IF". With this policy/softfork, you need to use "OP_SIZE OP_0NOTEQUAL OP_IF" or "OP_DEPTH OP_0NOTEQUAL OP_IF", or reconstruct your scripts. More related discussions could be found at https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2016-August/013036.html.


Updated on: 2023-05-19T15:26:45.028955+00:00