Adds a GetOutputType()
method to get the OutputType of a descriptor. Some descriptors don’t have a determinate OutputType, so we actually use an Optional<OutputType>
. For descriptors with indeterminate OutputType, we return nullopt
.
addr()
and raw()
use OutputTypes as determined by the CTxDestination they have. For simplicity, ScriptHash
destinations are LEGACY
even though they could be P2SH_SEGWIT
.
combo()
, pk()
, and multi()
are nullopt
as they either don’t have an OutputType or they have multiple. DescriptorImpl
defaults to nullopt
.
pkh()
is LEGACY
as expected
wpkh()
and wsh()
are BECH32
as expected.
sh()
checks whether the sub-descriptor is BECH32
. If so, it is P2SH_SEGWIT
. Otherwise it is LEGACY
.
The descriptor tests are updated to check the OutputType too.