Change SetType to SetInternal and remove m_address_type

m_address_type was used for two things:
1. Determine the type of descriptor to generate during
   SetupDescriptorGeneration
2. Sanity check during GetNewDestination.

There is no need to have this variable to accomplish those things.
1. Add a argument to SetupDescriptorGeneration indicating the address
   type to use
2. Use Descriptor::GetOutputType for the sanity check.
This commit is contained in:
Andrew Chow
2020-04-27 15:27:43 -04:00
parent 89b1ce1140
commit ca2a09640f
3 changed files with 16 additions and 16 deletions

View File

@@ -224,7 +224,7 @@ public:
virtual uint256 GetID() const { return uint256(); }
virtual void SetType(OutputType type, bool internal) {}
virtual void SetInternal(bool internal) {}
/** Prepends the wallet name in logging output to ease debugging in multi-wallet use cases */
template<typename... Params>
@@ -370,7 +370,7 @@ public:
uint256 GetID() const override;
void SetType(OutputType type, bool internal) override;
void SetInternal(bool internal) override;
// Map from Key ID to key metadata.
std::map<CKeyID, CKeyMetadata> mapKeyMetadata GUARDED_BY(cs_KeyStore);
@@ -497,7 +497,6 @@ private:
PubKeyMap m_map_pubkeys GUARDED_BY(cs_desc_man);
int32_t m_max_cached_index = -1;
OutputType m_address_type;
bool m_internal = false;
KeyMap m_map_keys GUARDED_BY(cs_desc_man);
@@ -522,9 +521,9 @@ public:
: ScriptPubKeyMan(storage),
m_wallet_descriptor(descriptor)
{}
DescriptorScriptPubKeyMan(WalletStorage& storage, OutputType address_type, bool internal)
DescriptorScriptPubKeyMan(WalletStorage& storage, bool internal)
: ScriptPubKeyMan(storage),
m_address_type(address_type), m_internal(internal)
m_internal(internal)
{}
mutable RecursiveMutex cs_desc_man;
@@ -549,7 +548,7 @@ public:
bool IsHDEnabled() const override;
//! Setup descriptors based on the given CExtkey
bool SetupDescriptorGeneration(const CExtKey& master_key);
bool SetupDescriptorGeneration(const CExtKey& master_key, OutputType addr_type);
bool HavePrivateKeys() const override;
@@ -573,7 +572,7 @@ public:
uint256 GetID() const override;
void SetType(OutputType type, bool internal) override;
void SetInternal(bool internal) override;
void SetCache(const DescriptorCache& cache);