aboutsummaryrefslogtreecommitdiff
path: root/src/base58.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/base58.h
parent5d891489ab7828ad8db15e85bb63e2f13f021a6a (diff)
downloadbitcoin-dfa23b94c24aae6466152fccbe896ba5dc0e97b4.tar.xz
CSecret/CKey -> CKey/CPubKey split/refactor
Diffstat (limited to 'src/base58.h')
-rw-r--r--src/base58.h22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/base58.h b/src/base58.h
index be8a541f67..efe3a95ebd 100644
--- a/src/base58.h
+++ b/src/base58.h
@@ -398,21 +398,19 @@ bool inline CBitcoinAddressVisitor::operator()(const CNoDestination &id) const {
class CBitcoinSecret : public CBase58Data
{
public:
- void SetSecret(const CSecret& vchSecret, bool fCompressed)
+ void SetKey(const CKey& vchSecret)
{
- assert(vchSecret.size() == 32);
- SetData(fTestNet ? 239 : 128, &vchSecret[0], vchSecret.size());
- if (fCompressed)
+ assert(vchSecret.IsValid());
+ SetData(fTestNet ? 239 : 128, vchSecret.begin(), vchSecret.size());
+ if (vchSecret.IsCompressed())
vchData.push_back(1);
}
- CSecret GetSecret(bool &fCompressedOut)
+ CKey GetKey()
{
- CSecret vchSecret;
- vchSecret.resize(32);
- memcpy(&vchSecret[0], &vchData[0], 32);
- fCompressedOut = vchData.size() == 33;
- return vchSecret;
+ CKey ret;
+ ret.Set(&vchData[0], &vchData[32], vchData.size() > 32 && vchData[32] == 1);
+ return ret;
}
bool IsValid() const
@@ -443,9 +441,9 @@ public:
return SetString(strSecret.c_str());
}
- CBitcoinSecret(const CSecret& vchSecret, bool fCompressed)
+ CBitcoinSecret(const CKey& vchSecret)
{
- SetSecret(vchSecret, fCompressed);
+ SetKey(vchSecret);
}
CBitcoinSecret()