New BIP: Dealing with OP_IF and OP_NOTIF malleability in P2WSH



Summary:

The Bitcoin script validity rules are proposed to change in order to make transaction malleability related to OP_IF and OP_NOTIF impossible in pay-to-witness-script-hash (P2WSH) scripts. This would result in the argument for OP_IF and OP_NOTIF being exactly an empty vector or 0x01, or the script evaluation fails immediately. The policy has received a few concept ACKs. A BIP is prepared to deal with OP_IF and OP_NOTIF malleability in P2WSH. 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. The proposed changes affect 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. This is a softfork on top of BIP141. It is enforced as a relay policy by the reference client since the first release of BIP141. Users must not create P2WSH scripts that are incompatible with this BIP to avoid risks of fund loss.


Updated on: 2023-05-19T23:45:01.014688+00:00