From eb81fc3ee58d3e88af36d8091b9e4017a8603b3c Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Mon, 7 Oct 2019 14:11:34 -0400 Subject: Refactor: Allow LegacyScriptPubKeyMan to be null In CWallet::LoadWallet, use this to detect and empty wallet with no keys This commit does not change behavior. --- src/wallet/wallet.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/wallet/wallet.h') diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index ef4c8ea8a1..a3efdb813b 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1140,19 +1140,17 @@ public: const SigningProvider* GetSigningProvider(const CScript& script, SignatureData& sigdata) const; LegacyScriptPubKeyMan* GetLegacyScriptPubKeyMan() const; + LegacyScriptPubKeyMan* GetOrCreateLegacyScriptPubKeyMan(); + + //! Make a LegacyScriptPubKeyMan and set it for all types, internal, and external. + void SetupLegacyScriptPubKeyMan(); const CKeyingMaterial& GetEncryptionKey() const override; bool HasEncryptionKeys() const override; // Temporary LegacyScriptPubKeyMan accessors and aliases. friend class LegacyScriptPubKeyMan; - std::unique_ptr m_spk_man = MakeUnique(*this); - RecursiveMutex& cs_KeyStore = m_spk_man->cs_KeyStore; - LegacyScriptPubKeyMan::KeyMap& mapKeys GUARDED_BY(cs_KeyStore) = m_spk_man->mapKeys; - LegacyScriptPubKeyMan::ScriptMap& mapScripts GUARDED_BY(cs_KeyStore) = m_spk_man->mapScripts; - LegacyScriptPubKeyMan::CryptedKeyMap& mapCryptedKeys GUARDED_BY(cs_KeyStore) = m_spk_man->mapCryptedKeys; - LegacyScriptPubKeyMan::WatchOnlySet& setWatchOnly GUARDED_BY(cs_KeyStore) = m_spk_man->setWatchOnly; - LegacyScriptPubKeyMan::WatchKeyMap& mapWatchKeys GUARDED_BY(cs_KeyStore) = m_spk_man->mapWatchKeys; + std::unique_ptr m_spk_man; /** Get last block processed height */ int GetLastBlockHeight() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) -- cgit v1.2.3