aboutsummaryrefslogtreecommitdiff
path: root/src/keystore.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2013-05-01 06:52:05 +0200
committerPieter Wuille <sipa@ulyssis.org>2013-05-30 05:20:21 +0200
commitdfa23b94c24aae6466152fccbe896ba5dc0e97b4 (patch)
treea1f7f856577b2223bae9351c960b595b4032ce7a /src/keystore.h
parent5d891489ab7828ad8db15e85bb63e2f13f021a6a (diff)
CSecret/CKey -> CKey/CPubKey split/refactor
Diffstat (limited to 'src/keystore.h')
-rw-r--r--src/keystore.h21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/keystore.h b/src/keystore.h
index ab369bbf47..49a7bf569d 100644
--- a/src/keystore.h
+++ b/src/keystore.h
@@ -21,7 +21,8 @@ public:
virtual ~CKeyStore() {}
// Add a key to the store.
- virtual bool AddKey(const CKey& key) =0;
+ 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;
@@ -33,18 +34,9 @@ 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;
-
- virtual bool GetSecret(const CKeyID &address, CSecret& vchSecret, bool &fCompressed) const
- {
- CKey key;
- if (!GetKey(address, key))
- return false;
- vchSecret = key.GetSecret(fCompressed);
- return true;
- }
};
-typedef std::map<CKeyID, std::pair<CSecret, bool> > KeyMap;
+typedef std::map<CKeyID, CKey> KeyMap;
typedef std::map<CScriptID, CScript > ScriptMap;
/** Basic key store, that keeps keys in an address->secret map */
@@ -55,7 +47,7 @@ protected:
ScriptMap mapScripts;
public:
- bool AddKey(const CKey& key);
+ bool AddKeyPubKey(const CKey& key, const CPubKey &pubkey);
bool HaveKey(const CKeyID &address) const
{
bool result;
@@ -85,8 +77,7 @@ public:
KeyMap::const_iterator mi = mapKeys.find(address);
if (mi != mapKeys.end())
{
- keyOut.Reset();
- keyOut.SetSecret((*mi).second.first, (*mi).second.second);
+ keyOut = mi->second;
return true;
}
}
@@ -146,7 +137,7 @@ public:
bool Lock();
virtual bool AddCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret);
- bool AddKey(const CKey& key);
+ bool AddKeyPubKey(const CKey& key, const CPubKey &pubkey);
bool HaveKey(const CKeyID &address) const
{
{