From 6dbe4d10728f882986ed0d9ed77bc736f051c662 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Fri, 4 Jun 2021 16:42:33 -0400 Subject: Use BECH32M for tr() desc, WitV1Taproot, and WitUnknown CTxDests The tr() descriptor, WitnessV1Taproot CTxDestination, and WitnessUnknown CTxDestination are OutputType::BECH32M so they should report as such. --- src/script/descriptor.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/script') diff --git a/src/script/descriptor.cpp b/src/script/descriptor.cpp index 84a8b06c5c..5da249b7f9 100644 --- a/src/script/descriptor.cpp +++ b/src/script/descriptor.cpp @@ -646,11 +646,13 @@ static std::optional OutputTypeFromDestination(const CTxDestination& return OutputType::LEGACY; } if (std::holds_alternative(dest) || - std::holds_alternative(dest) || - std::holds_alternative(dest) || - std::holds_alternative(dest)) { + std::holds_alternative(dest)) { return OutputType::BECH32; } + if (std::holds_alternative(dest) || + std::holds_alternative(dest)) { + return OutputType::BECH32M; + } return std::nullopt; } @@ -874,7 +876,7 @@ public: { assert(m_subdescriptor_args.size() == m_depths.size()); } - std::optional GetOutputType() const override { return OutputType::BECH32; } + std::optional GetOutputType() const override { return OutputType::BECH32M; } bool IsSingleType() const final { return true; } }; -- cgit v1.2.3 From 87a0e7a3b7c0ffd545e537bd497cdc3e67d045f6 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Fri, 4 Jun 2021 17:35:47 -0400 Subject: Disallow bech32m addresses for legacy wallet things We don't want the legacy wallet to ever have bech32m addresses so don't allow importing them. This includes addmultisigaddress as that is a legacy wallet only RPC Additionally, bech32m multisigs are not available yet, so disallow them in createmultisig. --- src/script/descriptor.cpp | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'src/script') diff --git a/src/script/descriptor.cpp b/src/script/descriptor.cpp index 5da249b7f9..d796ed26aa 100644 --- a/src/script/descriptor.cpp +++ b/src/script/descriptor.cpp @@ -640,22 +640,6 @@ public: std::optional GetOutputType() const override { return std::nullopt; } }; -static std::optional OutputTypeFromDestination(const CTxDestination& dest) { - if (std::holds_alternative(dest) || - std::holds_alternative(dest)) { - return OutputType::LEGACY; - } - if (std::holds_alternative(dest) || - std::holds_alternative(dest)) { - return OutputType::BECH32; - } - if (std::holds_alternative(dest) || - std::holds_alternative(dest)) { - return OutputType::BECH32M; - } - return std::nullopt; -} - /** A parsed addr(A) descriptor. */ class AddressDescriptor final : public DescriptorImpl { -- cgit v1.2.3