Replace LegacyScriptPubKeyMan::IsCrypted with LegacyScriptPubKeyMan::HasEncryptionKeys

This commit is contained in:
Andrew Chow 2019-12-05 17:33:00 -05:00
parent bf6417142f
commit 7cecf10ac3
2 changed files with 6 additions and 8 deletions

View File

@ -549,7 +549,7 @@ bool LegacyScriptPubKeyMan::AddKeyPubKeyWithDB(WalletBatch& batch, const CKey& s
RemoveWatchOnly(script); RemoveWatchOnly(script);
} }
if (!IsCrypted()) { if (!m_storage.HasEncryptionKeys()) {
return batch.WriteKey(pubkey, return batch.WriteKey(pubkey,
secret.GetPrivKey(), secret.GetPrivKey(),
mapKeyMetadata[pubkey.GetID()]); mapKeyMetadata[pubkey.GetID()]);
@ -590,7 +590,7 @@ void LegacyScriptPubKeyMan::LoadScriptMetadata(const CScriptID& script_id, const
bool LegacyScriptPubKeyMan::AddKeyPubKeyInner(const CKey& key, const CPubKey &pubkey) bool LegacyScriptPubKeyMan::AddKeyPubKeyInner(const CKey& key, const CPubKey &pubkey)
{ {
LOCK(cs_KeyStore); LOCK(cs_KeyStore);
if (!IsCrypted()) { if (!m_storage.HasEncryptionKeys()) {
return FillableSigningProvider::AddKeyPubKey(key, pubkey); return FillableSigningProvider::AddKeyPubKey(key, pubkey);
} }
@ -745,7 +745,7 @@ void LegacyScriptPubKeyMan::SetHDChain(const CHDChain& chain, bool memonly)
bool LegacyScriptPubKeyMan::HaveKey(const CKeyID &address) const bool LegacyScriptPubKeyMan::HaveKey(const CKeyID &address) const
{ {
LOCK(cs_KeyStore); LOCK(cs_KeyStore);
if (!IsCrypted()) { if (!m_storage.HasEncryptionKeys()) {
return FillableSigningProvider::HaveKey(address); return FillableSigningProvider::HaveKey(address);
} }
return mapCryptedKeys.count(address) > 0; return mapCryptedKeys.count(address) > 0;
@ -754,7 +754,7 @@ bool LegacyScriptPubKeyMan::HaveKey(const CKeyID &address) const
bool LegacyScriptPubKeyMan::GetKey(const CKeyID &address, CKey& keyOut) const bool LegacyScriptPubKeyMan::GetKey(const CKeyID &address, CKey& keyOut) const
{ {
LOCK(cs_KeyStore); LOCK(cs_KeyStore);
if (!IsCrypted()) { if (!m_storage.HasEncryptionKeys()) {
return FillableSigningProvider::GetKey(address, keyOut); return FillableSigningProvider::GetKey(address, keyOut);
} }
@ -801,7 +801,7 @@ bool LegacyScriptPubKeyMan::GetWatchPubKey(const CKeyID &address, CPubKey &pubke
bool LegacyScriptPubKeyMan::GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const bool LegacyScriptPubKeyMan::GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const
{ {
LOCK(cs_KeyStore); LOCK(cs_KeyStore);
if (!IsCrypted()) { if (!m_storage.HasEncryptionKeys()) {
if (!FillableSigningProvider::GetPubKey(address, vchPubKeyOut)) { if (!FillableSigningProvider::GetPubKey(address, vchPubKeyOut)) {
return GetWatchPubKey(address, vchPubKeyOut); return GetWatchPubKey(address, vchPubKeyOut);
} }
@ -1387,7 +1387,7 @@ bool LegacyScriptPubKeyMan::ImportScriptPubKeys(const std::set<CScript>& script_
std::set<CKeyID> LegacyScriptPubKeyMan::GetKeys() const std::set<CKeyID> LegacyScriptPubKeyMan::GetKeys() const
{ {
LOCK(cs_KeyStore); LOCK(cs_KeyStore);
if (!IsCrypted()) { if (!m_storage.HasEncryptionKeys()) {
return FillableSigningProvider::GetKeys(); return FillableSigningProvider::GetKeys();
} }
std::set<CKeyID> set_address; std::set<CKeyID> set_address;
@ -1403,7 +1403,6 @@ LegacyScriptPubKeyMan::LegacyScriptPubKeyMan(CWallet& wallet)
m_wallet(wallet), m_wallet(wallet),
cs_wallet(wallet.cs_wallet) {} cs_wallet(wallet.cs_wallet) {}
bool LegacyScriptPubKeyMan::IsCrypted() const { return m_wallet.IsCrypted(); }
void LegacyScriptPubKeyMan::NotifyWatchonlyChanged(bool fHaveWatchOnly) const { return m_wallet.NotifyWatchonlyChanged(fHaveWatchOnly); } void LegacyScriptPubKeyMan::NotifyWatchonlyChanged(bool fHaveWatchOnly) const { return m_wallet.NotifyWatchonlyChanged(fHaveWatchOnly); }
void LegacyScriptPubKeyMan::NotifyCanGetAddressesChanged() const { return m_wallet.NotifyCanGetAddressesChanged(); } void LegacyScriptPubKeyMan::NotifyCanGetAddressesChanged() const { return m_wallet.NotifyCanGetAddressesChanged(); }
template<typename... Params> void LegacyScriptPubKeyMan::WalletLogPrintf(const std::string& fmt, const Params&... parameters) const { return m_wallet.WalletLogPrintf(fmt, parameters...); } template<typename... Params> void LegacyScriptPubKeyMan::WalletLogPrintf(const std::string& fmt, const Params&... parameters) const { return m_wallet.WalletLogPrintf(fmt, parameters...); }

View File

@ -412,7 +412,6 @@ public:
friend class CWallet; friend class CWallet;
friend class ReserveDestination; friend class ReserveDestination;
LegacyScriptPubKeyMan(CWallet& wallet); LegacyScriptPubKeyMan(CWallet& wallet);
bool IsCrypted() const;
void NotifyWatchonlyChanged(bool fHaveWatchOnly) const; void NotifyWatchonlyChanged(bool fHaveWatchOnly) const;
void NotifyCanGetAddressesChanged() const; void NotifyCanGetAddressesChanged() const;
template<typename... Params> void WalletLogPrintf(const std::string& fmt, const Params&... parameters) const; template<typename... Params> void WalletLogPrintf(const std::string& fmt, const Params&... parameters) const;