1515
1616#include < boost/signals2/signal.hpp>
1717
18- /* * A virtual base class for key stores */
19- class CKeyStore : public SigningProvider
20- {
21- public:
22- // ! Add a key to the store.
23- virtual bool AddKeyPubKey (const CKey &key, const CPubKey &pubkey) =0;
24-
25- // ! Check whether a key corresponding to a given address is present in the store.
26- virtual std::set<CKeyID> GetKeys () const =0;
27-
28- // ! Support for BIP 0013 : see https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki
29- virtual bool AddCScript (const CScript& redeemScript) =0;
30- virtual std::set<CScriptID> GetCScripts () const =0;
31-
32- // ! Support for Watch-only addresses
33- virtual bool AddWatchOnly (const CScript &dest) =0;
34- virtual bool RemoveWatchOnly (const CScript &dest) =0;
35- virtual bool HaveWatchOnly (const CScript &dest) const =0;
36- virtual bool HaveWatchOnly () const =0;
37- };
38-
3918/* * Basic key store, that keeps keys in an address->secret map */
40- class CBasicKeyStore : public CKeyStore
19+ class CBasicKeyStore : public SigningProvider
4120{
4221protected:
4322 mutable CCriticalSection cs_KeyStore;
@@ -55,27 +34,27 @@ class CBasicKeyStore : public CKeyStore
5534 void ImplicitlyLearnRelatedKeyScripts (const CPubKey& pubkey) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore);
5635
5736public:
58- bool AddKeyPubKey (const CKey& key, const CPubKey &pubkey) override ;
59- bool AddKey (const CKey &key) { return AddKeyPubKey (key, key.GetPubKey ()); }
60- bool GetPubKey (const CKeyID &address, CPubKey& vchPubKeyOut) const override ;
61- bool HaveKey (const CKeyID &address) const override ;
62- std::set<CKeyID> GetKeys () const override ;
63- bool GetKey (const CKeyID &address, CKey &keyOut) const override ;
64- bool AddCScript (const CScript& redeemScript) override ;
65- bool HaveCScript (const CScriptID &hash) const override ;
66- std::set<CScriptID> GetCScripts () const override ;
67- bool GetCScript (const CScriptID &hash, CScript& redeemScriptOut) const override ;
68-
69- bool AddWatchOnly (const CScript &dest) override ;
70- bool RemoveWatchOnly (const CScript &dest) override ;
71- bool HaveWatchOnly (const CScript &dest) const override ;
72- bool HaveWatchOnly () const override ;
37+ virtual bool AddKeyPubKey (const CKey& key, const CPubKey &pubkey);
38+ virtual bool AddKey (const CKey &key) { return AddKeyPubKey (key, key.GetPubKey ()); }
39+ virtual bool GetPubKey (const CKeyID &address, CPubKey& vchPubKeyOut) const override ;
40+ virtual bool HaveKey (const CKeyID &address) const override ;
41+ virtual std::set<CKeyID> GetKeys () const ;
42+ virtual bool GetKey (const CKeyID &address, CKey &keyOut) const override ;
43+ virtual bool AddCScript (const CScript& redeemScript);
44+ virtual bool HaveCScript (const CScriptID &hash) const override ;
45+ virtual std::set<CScriptID> GetCScripts () const ;
46+ virtual bool GetCScript (const CScriptID &hash, CScript& redeemScriptOut) const override ;
47+
48+ virtual bool AddWatchOnly (const CScript &dest);
49+ virtual bool RemoveWatchOnly (const CScript &dest);
50+ virtual bool HaveWatchOnly (const CScript &dest) const ;
51+ virtual bool HaveWatchOnly () const ;
7352};
7453
7554/* * Return the CKeyID of the key involved in a script (if there is a unique one). */
76- CKeyID GetKeyForDestination (const CKeyStore & store, const CTxDestination& dest);
55+ CKeyID GetKeyForDestination (const CBasicKeyStore & store, const CTxDestination& dest);
7756
78- /* * Checks if a CKey is in the given CKeyStore compressed or otherwise*/
79- bool HaveKey (const CKeyStore & store, const CKey& key);
57+ /* * Checks if a CKey is in the given CBasicKeyStore compressed or otherwise*/
58+ bool HaveKey (const CBasicKeyStore & store, const CKey& key);
8059
8160#endif // BITCOIN_KEYSTORE_H
0 commit comments