aboutsummaryrefslogtreecommitdiff
path: root/src/keystore.cpp
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.cpp
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.cpp')
-rw-r--r--src/keystore.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/keystore.cpp b/src/keystore.cpp
index 9e1dab65fd..2125d8472a 100644
--- a/src/keystore.cpp
+++ b/src/keystore.cpp
@@ -16,10 +16,10 @@ std::vector<unsigned char> CKeyStore::GenerateNewKey()
return key.GetPubKey();
}
-bool CKeyStore::GetPubKey(const uint160 &hashAddress, std::vector<unsigned char> &vchPubKeyOut) const
+bool CKeyStore::GetPubKey(const CBitcoinAddress &address, std::vector<unsigned char> &vchPubKeyOut) const
{
CKey key;
- if (!GetKey(hashAddress, key))
+ if (!GetKey(address, key))
return false;
vchPubKeyOut = key.GetPubKey();
return true;
@@ -28,7 +28,7 @@ bool CKeyStore::GetPubKey(const uint160 &hashAddress, std::vector<unsigned char>
bool CBasicKeyStore::AddKey(const CKey& key)
{
CRITICAL_BLOCK(cs_KeyStore)
- mapKeys[Hash160(key.GetPubKey())] = key.GetSecret();
+ mapKeys[key.GetAddress()] = key.GetSecret();
return true;
}
@@ -98,19 +98,19 @@ bool CCryptoKeyStore::AddCryptedKey(const std::vector<unsigned char> &vchPubKey,
if (!SetCrypted())
return false;
- mapCryptedKeys[Hash160(vchPubKey)] = make_pair(vchPubKey, vchCryptedSecret);
+ mapCryptedKeys[CBitcoinAddress(vchPubKey)] = make_pair(vchPubKey, vchCryptedSecret);
}
return true;
}
-bool CCryptoKeyStore::GetKey(const uint160 &hashAddress, CKey& keyOut) const
+bool CCryptoKeyStore::GetKey(const CBitcoinAddress &address, CKey& keyOut) const
{
CRITICAL_BLOCK(cs_vMasterKey)
{
if (!IsCrypted())
- return CBasicKeyStore::GetKey(hashAddress, keyOut);
+ return CBasicKeyStore::GetKey(address, keyOut);
- CryptedKeyMap::const_iterator mi = mapCryptedKeys.find(hashAddress);
+ CryptedKeyMap::const_iterator mi = mapCryptedKeys.find(address);
if (mi != mapCryptedKeys.end())
{
const std::vector<unsigned char> &vchPubKey = (*mi).second.first;
@@ -125,14 +125,14 @@ bool CCryptoKeyStore::GetKey(const uint160 &hashAddress, CKey& keyOut) const
return false;
}
-bool CCryptoKeyStore::GetPubKey(const uint160 &hashAddress, std::vector<unsigned char>& vchPubKeyOut) const
+bool CCryptoKeyStore::GetPubKey(const CBitcoinAddress &address, std::vector<unsigned char>& vchPubKeyOut) const
{
CRITICAL_BLOCK(cs_vMasterKey)
{
if (!IsCrypted())
- return CKeyStore::GetPubKey(hashAddress, vchPubKeyOut);
+ return CKeyStore::GetPubKey(address, vchPubKeyOut);
- CryptedKeyMap::const_iterator mi = mapCryptedKeys.find(hashAddress);
+ CryptedKeyMap::const_iterator mi = mapCryptedKeys.find(address);
if (mi != mapCryptedKeys.end())
{
vchPubKeyOut = (*mi).second.first;