Safer sighashes and more granular SIGHASH_NOINPUT



Summary:

In a recent discussion on the Bitcoin-Dev email list, Johnson Lau asked whether or not OP_CODESEPARATOR was useful under Taproot. In response to this, Anthony Towns stated that he didn't think it was useful without conditionals, as committing to the (masked) script gives you everything you could do with codeseparator. He also stated that if best practices are always followed by using a different key in different branches, committing to masked script is not necessary. However, Towns noted that for some types of scripts, such as those involving DEPTH 3 EQUAL, IF, ELSE, ENDIF, and CODESEP, the IF+CODESEP approach is actually cheaper if you're mostly taking the S1 branch, because the overhead is less than the 32B overhead to choose a merkle branch. When asked about disabling CODESEPARATOR, Towns noted that even if it was disabled, it could be re-enabled fairly easily in a new script subversion if needed. Finally, in regards to whether or not anyone had a better use case for CODESEPARATOR, there was no response.


Updated on: 2023-05-20T18:02:11.276711+00:00