diff options
-rw-r--r-- | doc/developer-notes.md | 2 | ||||
-rw-r--r-- | src/keystore.cpp | 4 | ||||
-rw-r--r-- | src/keystore.h | 7 |
3 files changed, 4 insertions, 9 deletions
diff --git a/doc/developer-notes.md b/doc/developer-notes.md index a152f86e17..f10ad8e877 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -219,7 +219,7 @@ inconsistencies reported in the debug.log file. Re-architecting the core code so there are better-defined interfaces between the various components is a goal, with any necessary locking -done by the components (e.g. see the self-contained CKeyStore class +done by the components (e.g. see the self-contained CBasicKeyStore class and its cs_KeyStore lock for example). Threads diff --git a/src/keystore.cpp b/src/keystore.cpp index fab1b81c9a..dfdfa5ea9f 100644 --- a/src/keystore.cpp +++ b/src/keystore.cpp @@ -7,10 +7,6 @@ #include <util.h> -bool CKeyStore::AddKey(const CKey &key) { - return AddKeyPubKey(key, key.GetPubKey()); -} - void CBasicKeyStore::ImplicitlyLearnRelatedKeyScripts(const CPubKey& pubkey) { AssertLockHeld(cs_KeyStore); diff --git a/src/keystore.h b/src/keystore.h index ff5613f617..fa912cb195 100644 --- a/src/keystore.h +++ b/src/keystore.h @@ -18,13 +18,9 @@ /** A virtual base class for key stores */ class CKeyStore : public SigningProvider { -protected: - mutable CCriticalSection cs_KeyStore; - public: //! Add a key to the store. virtual bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey) =0; - virtual bool AddKey(const CKey &key); //! Check whether a key corresponding to a given address is present in the store. virtual bool HaveKey(const CKeyID &address) const =0; @@ -51,6 +47,8 @@ typedef std::set<CScript> WatchOnlySet; class CBasicKeyStore : public CKeyStore { protected: + mutable CCriticalSection cs_KeyStore; + KeyMap mapKeys; WatchKeyMap mapWatchKeys; ScriptMap mapScripts; @@ -60,6 +58,7 @@ protected: public: bool AddKeyPubKey(const CKey& key, const CPubKey &pubkey) override; + bool AddKey(const CKey &key) { return AddKeyPubKey(key, key.GetPubKey()); } bool GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const override; bool HaveKey(const CKeyID &address) const override; std::set<CKeyID> GetKeys() const override; |