segwit naming ambiguity



Summary:

Transactions can be classified as segwit if they adhere to the witness program structure defined in BIP141, which includes a 1-byte push opcode followed by a data push between 2 and 40 bytes. This classification applies to both version 0 segwit outputs and version 1 taproot outputs. To differentiate between v0 and taproot scripts, a different function could be proposed, similar to the enum used in Bitcoin Core. However, the naming scheme of the enum used in the wallet logic of Bitcoin Core is confusing and should be avoided. It's important to consider nested witness programs inside P2SH and determine whether they should be differentiated from other P2SH. Core has separate enums for this purpose. Ambiguity may arise, so it is necessary to explicitly document how these functions would return for different types of programs. Even though nested programs technically have segregated witness data, they should also be considered segwit for a simple `is_segwit` check. The term "v0" commonly refers to version 0 segwit.


Updated on: 2023-08-12T01:47:50.890523+00:00