Here's my idea for a clean API:

1. `is_segwit()` returns true for a p2tr output

2. a function `segwit_version()` which returns an int according to segwit version used

3. helper functions like `is_p2wpkh()`, `is_p2tr()`, `is_p2wsh()` for all script types which all return a bool
 

On Fri, 11 Aug 2023 at 08:41, Tobin Harding via bitcoin-dev <bitcoin-dev@lists.linuxfoundation.org> wrote:
Question for OG bitcoin API designers please.

If you were to see the following function

    `is_segwit()`

would you assume it returns `true` or `false` for a p2tr transaction?


Currently we (rust-bitcoin) are being liberal with the use of `v0` but
its a pretty ugly. Is there an official, or widely used, name for segwit v0?


Thanks,
Tobin.
_______________________________________________
bitcoin-dev mailing list
bitcoin-dev@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev


--
Best Regards / S pozdravom,

Pavol "Stick" Rusnak
Co-Founder, SatoshiLabs