aboutsummaryrefslogtreecommitdiff
path: root/src/keystore.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/keystore.h')
-rw-r--r--src/keystore.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/keystore.h b/src/keystore.h
index 79d8661aca..72411a1387 100644
--- a/src/keystore.h
+++ b/src/keystore.h
@@ -8,11 +8,21 @@
#include "key.h"
#include "sync.h"
+#include "script.h" // for CNoDestination
#include <boost/signals2/signal.hpp>
+#include <boost/variant.hpp>
class CScript;
+/** A txout script template with a specific destination. It is either:
+ * * CNoDestination: no destination set
+ * * CKeyID: TX_PUBKEYHASH destination
+ * * CScriptID: TX_SCRIPTHASH destination
+ * A CTxDestination is the internal data type encoded in a CBitcoinAddress
+ */
+typedef boost::variant<CNoDestination, CKeyID, CScriptID> CTxDestination;
+
/** A virtual base class for key stores */
class CKeyStore
{
@@ -36,10 +46,15 @@ public:
virtual bool AddCScript(const CScript& redeemScript) =0;
virtual bool HaveCScript(const CScriptID &hash) const =0;
virtual bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const =0;
+
+ // Support for Watch-only addresses
+ virtual bool AddWatchOnly(const CScript &dest) =0;
+ virtual bool HaveWatchOnly(const CScript &dest) const =0;
};
typedef std::map<CKeyID, CKey> KeyMap;
typedef std::map<CScriptID, CScript > ScriptMap;
+typedef std::set<CScript> WatchOnlySet;
/** Basic key store, that keeps keys in an address->secret map */
class CBasicKeyStore : public CKeyStore
@@ -47,6 +62,7 @@ class CBasicKeyStore : public CKeyStore
protected:
KeyMap mapKeys;
ScriptMap mapScripts;
+ WatchOnlySet setWatchOnly;
public:
bool AddKeyPubKey(const CKey& key, const CPubKey &pubkey);
@@ -88,6 +104,9 @@ public:
virtual bool AddCScript(const CScript& redeemScript);
virtual bool HaveCScript(const CScriptID &hash) const;
virtual bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const;
+
+ virtual bool AddWatchOnly(const CScript &dest);
+ virtual bool HaveWatchOnly(const CScript &dest) const;
};
typedef std::vector<unsigned char, secure_allocator<unsigned char> > CKeyingMaterial;