diff options
author | Samuel Dobson <dobsonsa68@gmail.com> | 2020-02-22 07:57:56 +1300 |
---|---|---|
committer | Samuel Dobson <dobsonsa68@gmail.com> | 2020-02-22 08:02:52 +1300 |
commit | 9dd7bd47be2f046ea4b114ab86a099ec483d9f3a (patch) | |
tree | ae7353fce13a513d3de0711dcb10ac5779656e30 /src/script/keyorigin.h | |
parent | e9fc8f6e7f572224d2bd4577eee6d538331ef663 (diff) | |
parent | 7e80f646b24a2abf3c031a649bcc706a695f80da (diff) |
Merge #18034: Get the OutputType for a descriptor
7e80f646b24a2abf3c031a649bcc706a695f80da Get the OutputType for a descriptor (Andrew Chow)
Pull request description:
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.
ACKs for top commit:
fjahr:
ACK 7e80f646b24a2abf3c031a649bcc706a695f80da
meshcollider:
utACK 7e80f646b24a2abf3c031a649bcc706a695f80da
instagibbs:
cursory ACK https://github.com/bitcoin/bitcoin/pull/18034/commits/7e80f646b24a2abf3c031a649bcc706a695f80da
Sjors:
Code review ACK 7e80f646b24a2abf3c031a649bcc706a695f80da
jonatack:
ACK 7e80f64 code review/build/tests
Tree-SHA512: c5a813447b62e982435e1c948066f8d6c148c9ebffb0a5eb5a9028b173b01d5ead2f076a5ca3f7f37698538baa346f82a977ee48f583d89cb4e5ebd9111b2341
Diffstat (limited to 'src/script/keyorigin.h')
0 files changed, 0 insertions, 0 deletions