aboutsummaryrefslogtreecommitdiff
path: root/src/base58.h
diff options
context:
space:
mode:
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()