wallet: make CanGetAddresses() const
CWallet::CanGetAddresses() is used to check whether the wallet has available or is able to produce keys for addresses. It uses the ScriptPubKeyMan::CanGetAddresses(), which in turn uses the const KeypoolCountExternalKeys() method, all which do counting and no modifications.
This commit is contained in:
6 files changed
+7
-7
No files matched your search
@@ -468,7 +468,7 @@ public:
|
|||||||
}
|
}
|
||||||
unsigned int getConfirmTarget() override { return m_wallet->m_confirm_target; }
|
unsigned int getConfirmTarget() override { return m_wallet->m_confirm_target; }
|
||||||
bool hdEnabled() override { return m_wallet->IsHDEnabled(); }
|
bool hdEnabled() override { return m_wallet->IsHDEnabled(); }
|
||||||
bool canGetAddresses() override { return m_wallet->CanGetAddresses(); }
|
bool canGetAddresses() const override { return m_wallet->CanGetAddresses(); }
|
||||||
bool IsWalletFlagSet(uint64_t flag) override { return m_wallet->IsWalletFlagSet(flag); }
|
bool IsWalletFlagSet(uint64_t flag) override { return m_wallet->IsWalletFlagSet(flag); }
|
||||||
OutputType getDefaultAddressType() override { return m_wallet->m_default_address_type; }
|
OutputType getDefaultAddressType() override { return m_wallet->m_default_address_type; }
|
||||||
OutputType getDefaultChangeType() override { return m_wallet->m_default_change_type; }
|
OutputType getDefaultChangeType() override { return m_wallet->m_default_change_type; }
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ public:
|
|||||||
virtual bool hdEnabled() = 0;
|
virtual bool hdEnabled() = 0;
|
||||||
|
|
||||||
// Return whether the wallet is blank.
|
// Return whether the wallet is blank.
|
||||||
virtual bool canGetAddresses() = 0;
|
virtual bool canGetAddresses() const = 0;
|
||||||
|
|
||||||
// check if a certain wallet flag is set.
|
// check if a certain wallet flag is set.
|
||||||
virtual bool IsWalletFlagSet(uint64_t flag) = 0;
|
virtual bool IsWalletFlagSet(uint64_t flag) = 0;
|
||||||
|
|||||||
@@ -358,7 +358,7 @@ bool LegacyScriptPubKeyMan::IsHDEnabled() const
|
|||||||
return !hdChain.seed_id.IsNull();
|
return !hdChain.seed_id.IsNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LegacyScriptPubKeyMan::CanGetAddresses(bool internal)
|
bool LegacyScriptPubKeyMan::CanGetAddresses(bool internal) const
|
||||||
{
|
{
|
||||||
LOCK(cs_KeyStore);
|
LOCK(cs_KeyStore);
|
||||||
// Check if the keypool has keys
|
// Check if the keypool has keys
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ public:
|
|||||||
virtual bool IsHDEnabled() const { return false; }
|
virtual bool IsHDEnabled() const { return false; }
|
||||||
|
|
||||||
/* Returns true if the wallet can give out new addresses. This means it has keys in the keypool or can generate new keys */
|
/* Returns true if the wallet can give out new addresses. This means it has keys in the keypool or can generate new keys */
|
||||||
virtual bool CanGetAddresses(bool internal = false) { return false; }
|
virtual bool CanGetAddresses(bool internal = false) const { return false; }
|
||||||
|
|
||||||
/** Upgrades the wallet to the specified version */
|
/** Upgrades the wallet to the specified version */
|
||||||
virtual bool Upgrade(int prev_version, std::string& error) { return false; }
|
virtual bool Upgrade(int prev_version, std::string& error) { return false; }
|
||||||
@@ -344,7 +344,7 @@ public:
|
|||||||
|
|
||||||
const CKeyMetadata* GetMetadata(const CTxDestination& dest) const override;
|
const CKeyMetadata* GetMetadata(const CTxDestination& dest) const override;
|
||||||
|
|
||||||
bool CanGetAddresses(bool internal = false) override;
|
bool CanGetAddresses(bool internal = false) const override;
|
||||||
|
|
||||||
std::unique_ptr<SigningProvider> GetSigningProvider(const CScript& script) const override;
|
std::unique_ptr<SigningProvider> GetSigningProvider(const CScript& script) const override;
|
||||||
|
|
||||||
|
|||||||
@@ -1333,7 +1333,7 @@ bool CWallet::IsHDEnabled() const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWallet::CanGetAddresses(bool internal)
|
bool CWallet::CanGetAddresses(bool internal) const
|
||||||
{
|
{
|
||||||
LOCK(cs_wallet);
|
LOCK(cs_wallet);
|
||||||
if (m_spk_managers.empty()) return false;
|
if (m_spk_managers.empty()) return false;
|
||||||
|
|||||||
+1
-1
@@ -1104,7 +1104,7 @@ public:
|
|||||||
bool IsHDEnabled() const;
|
bool IsHDEnabled() const;
|
||||||
|
|
||||||
/* Returns true if the wallet can give out new addresses. This means it has keys in the keypool or can generate new keys */
|
/* Returns true if the wallet can give out new addresses. This means it has keys in the keypool or can generate new keys */
|
||||||
bool CanGetAddresses(bool internal = false);
|
bool CanGetAddresses(bool internal = false) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Blocks until the wallet state is up-to-date to /at least/ the current
|
* Blocks until the wallet state is up-to-date to /at least/ the current
|
||||||
|
|||||||
Reference in new issue
Block a user