aboutsummaryrefslogtreecommitdiff
path: root/src/keystore.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2011-07-05 20:53:43 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2011-07-17 12:09:14 +0200
commit2ffba736e9102d016b96c2e5de2ce7757e612667 (patch)
treefb96acfec05aa767cb3ba2df9b93569f2a6c04db /src/keystore.h
parent03fbd7904903928b0d1c8542a3d597aaf5bdd31b (diff)
downloadbitcoin-2ffba736e9102d016b96c2e5de2ce7757e612667.tar.xz
Use CBitcoinAddress instead of string/uint160
Instead of conversion functions between pubkey/uint160/address in base58.h, have a fully fledged class CBitcoinAddress (CAddress was already taken) to represent addresses.
Diffstat (limited to 'src/keystore.h')
-rw-r--r--src/keystore.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/keystore.h b/src/keystore.h
index 976c095335..436053a9e3 100644
--- a/src/keystore.h
+++ b/src/keystore.h
@@ -12,13 +12,13 @@ public:
mutable CCriticalSection cs_KeyStore;
virtual bool AddKey(const CKey& key) =0;
- virtual bool HaveKey(const uint160 &hashAddress) const =0;
- virtual bool GetKey(const uint160 &hashAddress, CKey& keyOut) const =0;
- virtual bool GetPubKey(const uint160 &hashAddress, std::vector<unsigned char>& vchPubKeyOut) const;
+ virtual bool HaveKey(const CBitcoinAddress &address) const =0;
+ virtual bool GetKey(const CBitcoinAddress &address, CKey& keyOut) const =0;
+ virtual bool GetPubKey(const CBitcoinAddress &address, std::vector<unsigned char>& vchPubKeyOut) const;
virtual std::vector<unsigned char> GenerateNewKey();
};
-typedef std::map<uint160, CSecret> KeyMap;
+typedef std::map<CBitcoinAddress, CSecret> KeyMap;
class CBasicKeyStore : public CKeyStore
{
@@ -27,13 +27,13 @@ protected:
public:
bool AddKey(const CKey& key);
- bool HaveKey(const uint160 &hashAddress) const
+ bool HaveKey(const CBitcoinAddress &address) const
{
- return (mapKeys.count(hashAddress) > 0);
+ return (mapKeys.count(address) > 0);
}
- bool GetKey(const uint160 &hashAddress, CKey& keyOut) const
+ bool GetKey(const CBitcoinAddress &address, CKey& keyOut) const
{
- KeyMap::const_iterator mi = mapKeys.find(hashAddress);
+ KeyMap::const_iterator mi = mapKeys.find(address);
if (mi != mapKeys.end())
{
keyOut.SetSecret((*mi).second);
@@ -43,7 +43,7 @@ public:
}
};
-typedef std::map<uint160, std::pair<std::vector<unsigned char>, std::vector<unsigned char> > > CryptedKeyMap;
+typedef std::map<CBitcoinAddress, std::pair<std::vector<unsigned char>, std::vector<unsigned char> > > CryptedKeyMap;
class CCryptoKeyStore : public CBasicKeyStore
{
@@ -106,14 +106,14 @@ public:
virtual bool AddCryptedKey(const std::vector<unsigned char> &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret);
std::vector<unsigned char> GenerateNewKey();
bool AddKey(const CKey& key);
- bool HaveKey(const uint160 &hashAddress) const
+ bool HaveKey(const CBitcoinAddress &address) const
{
if (!IsCrypted())
- return CBasicKeyStore::HaveKey(hashAddress);
- return mapCryptedKeys.count(hashAddress) > 0;
+ return CBasicKeyStore::HaveKey(address);
+ return mapCryptedKeys.count(address) > 0;
}
- bool GetKey(const uint160 &hashAddress, CKey& keyOut) const;
- bool GetPubKey(const uint160 &hashAddress, std::vector<unsigned char>& vchPubKeyOut) const;
+ bool GetKey(const CBitcoinAddress &address, CKey& keyOut) const;
+ bool GetPubKey(const CBitcoinAddress &address, std::vector<unsigned char>& vchPubKeyOut) const;
};
#endif