diff options
author | Andrew Chow <achow101-github@achow101.com> | 2021-06-04 16:37:41 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2021-06-22 21:53:11 -0400 |
commit | 177c15d2f7cd5406ddbce8217fc023057539b828 (patch) | |
tree | 8a06ff84feb783bf06edb5dab49a8af7b18fcd64 /src/wallet/scriptpubkeyman.cpp | |
parent | c93e123dc72bfc1bd2c637fdcd032e570d53a7bd (diff) |
Limit LegacyScriptPubKeyMan address types
Make sure that LegacyScriptPubKeyMan can only be used for legacy,
p2sh-segwit, and bech32 address types.
Diffstat (limited to 'src/wallet/scriptpubkeyman.cpp')
-rw-r--r-- | src/wallet/scriptpubkeyman.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp index c8baa0665e..4212b6f34a 100644 --- a/src/wallet/scriptpubkeyman.cpp +++ b/src/wallet/scriptpubkeyman.cpp @@ -22,6 +22,11 @@ const uint32_t BIP32_HARDENED_KEY_LIMIT = 0x80000000; bool LegacyScriptPubKeyMan::GetNewDestination(const OutputType type, CTxDestination& dest, std::string& error) { + if (LEGACY_OUTPUT_TYPES.count(type) == 0) { + error = _("Error: Legacy wallets only support the \"legacy\", \"p2sh-segwit\", and \"bech32\" address types").translated; + return false; + } + LOCK(cs_KeyStore); error.clear(); @@ -291,6 +296,10 @@ bool LegacyScriptPubKeyMan::Encrypt(const CKeyingMaterial& master_key, WalletBat bool LegacyScriptPubKeyMan::GetReservedDestination(const OutputType type, bool internal, CTxDestination& address, int64_t& index, CKeyPool& keypool) { + if (LEGACY_OUTPUT_TYPES.count(type) == 0) { + return false; + } + LOCK(cs_KeyStore); if (!CanGetAddresses(internal)) { return false; |