aboutsummaryrefslogtreecommitdiff
path: root/src/keystore.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2018-03-17 19:19:09 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2018-03-25 13:26:57 -0700
commitd40f06a3da5e6b1fd065885b08513263fa930cb8 (patch)
tree80e3a485e4d9ecdc7a891ae3fd88f5fbd7011326 /src/keystore.h
parentaf20f9b1d485582b8c8aa8294bac4f2c540246d2 (diff)
downloadbitcoin-d40f06a3da5e6b1fd065885b08513263fa930cb8.tar.xz
Introduce interface for signing providers
CKeyStore is a rich interface that provides many features, including knowledge of scripts and pubkeys for solving, private keys for signing, in addition to watch-only keys and scripts, and distinguishing lack of keys from them just being encrypted. The signing logic in script/sign does not actually need most of these features. Here we introduce a simpler interface (SigningProvider) which *only* provides keys and scripts. This is actually sufficient for signing. In addtion, we swap the dependency between keystore and script/sign (keystore now depends on script/script with CKeyStore deriving from SigningProvider, rather than CKeyStore being the interface that signing relies on).
Diffstat (limited to 'src/keystore.h')
-rw-r--r--src/keystore.h8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/keystore.h b/src/keystore.h
index ffd3238fd6..ff5613f617 100644
--- a/src/keystore.h
+++ b/src/keystore.h
@@ -9,35 +9,31 @@
#include <key.h>
#include <pubkey.h>
#include <script/script.h>
+#include <script/sign.h>
#include <script/standard.h>
#include <sync.h>
#include <boost/signals2/signal.hpp>
/** A virtual base class for key stores */
-class CKeyStore
+class CKeyStore : public SigningProvider
{
protected:
mutable CCriticalSection cs_KeyStore;
public:
- virtual ~CKeyStore() {}
-
//! 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;
- virtual bool GetKey(const CKeyID &address, CKey& keyOut) const =0;
virtual std::set<CKeyID> GetKeys() const =0;
- virtual bool GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const =0;
//! Support for BIP 0013 : see https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki
virtual bool AddCScript(const CScript& redeemScript) =0;
virtual bool HaveCScript(const CScriptID &hash) const =0;
virtual std::set<CScriptID> GetCScripts() const =0;
- virtual bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const =0;
//! Support for Watch-only addresses
virtual bool AddWatchOnly(const CScript &dest) =0;