Cleanups and fixes.

This commit is contained in:
JoelKatz
2011-12-20 22:01:06 -08:00
parent d4276bfbec
commit 780f94798e
6 changed files with 54 additions and 292 deletions

View File

@@ -12,26 +12,25 @@
std::vector<unsigned char> CKeyStore::GenerateNewKey()
{
RandAddSeedPerfmon();
CKey key;
key.MakeNewKey();
if (!AddKey(key))
throw std::runtime_error("CKeyStore::GenerateNewKey() : AddKey failed");
return key.GetPubKey();
RandAddSeedPerfmon();
CKey key;
key.MakeNewKey();
if (!AddKey(key))
throw std::runtime_error("CKeyStore::GenerateNewKey() : AddKey failed");
return key.GetPubKey();
}
bool CKeyStore::GetPubKey(const NewcoinAddress &address, std::vector<unsigned char> &vchPubKeyOut) const
bool CKeyStore::GetPubKey(const NewcoinAddress& address, std::vector<unsigned char>& vchPubKeyOut) const
{
CKey key;
if (!GetKey(address, key))
return false;
vchPubKeyOut = key.GetPubKey();
return true;
CKey key;
if (!GetKey(address, key))
return false;
vchPubKeyOut = key.GetPubKey();
return true;
}
bool CBasicKeyStore::AddKey(const CKey& key)
{
mapKeys[key.GetAddress()] = key.GetSecret();
return true;
mapKeys[key.GetAddress()] = key.GetSecret();
return true;
}