Merge branch 'beta' into mergemaster
# Conflicts: # src/main.cpp
This commit is contained in:
40
src/base58.h
40
src/base58.h
@@ -96,26 +96,48 @@ public:
|
||||
bool operator> (const CBase58Data& b58) const { return CompareTo(b58) > 0; }
|
||||
};
|
||||
|
||||
class CZCPaymentAddress : public CBase58Data {
|
||||
template<class DATA_TYPE, CChainParams::Base58Type PREFIX, size_t SER_SIZE>
|
||||
class CZCEncoding : public CBase58Data {
|
||||
protected:
|
||||
virtual std::string PrependName(const std::string& s) const = 0;
|
||||
|
||||
public:
|
||||
bool Set(const DATA_TYPE& addr);
|
||||
|
||||
DATA_TYPE Get() const;
|
||||
};
|
||||
|
||||
class CZCPaymentAddress : public CZCEncoding<libzcash::PaymentAddress, CChainParams::ZCPAYMENT_ADDRRESS, libzcash::SerializedPaymentAddressSize> {
|
||||
protected:
|
||||
std::string PrependName(const std::string& s) const { return "payment address" + s; }
|
||||
|
||||
public:
|
||||
bool Set(const libzcash::PaymentAddress& addr);
|
||||
CZCPaymentAddress() {}
|
||||
|
||||
CZCPaymentAddress(const std::string& strAddress) { SetString(strAddress.c_str(), 2); }
|
||||
CZCPaymentAddress(const libzcash::PaymentAddress& addr) { Set(addr); }
|
||||
|
||||
libzcash::PaymentAddress Get() const;
|
||||
};
|
||||
|
||||
class CZCSpendingKey : public CBase58Data {
|
||||
class CZCViewingKey : public CZCEncoding<libzcash::ViewingKey, CChainParams::ZCVIEWING_KEY, libzcash::SerializedViewingKeySize> {
|
||||
protected:
|
||||
std::string PrependName(const std::string& s) const { return "viewing key" + s; }
|
||||
|
||||
public:
|
||||
CZCViewingKey() {}
|
||||
|
||||
CZCViewingKey(const std::string& strViewingKey) { SetString(strViewingKey.c_str(), 3); }
|
||||
CZCViewingKey(const libzcash::ViewingKey& vk) { Set(vk); }
|
||||
};
|
||||
|
||||
class CZCSpendingKey : public CZCEncoding<libzcash::SpendingKey, CChainParams::ZCSPENDING_KEY, libzcash::SerializedSpendingKeySize> {
|
||||
protected:
|
||||
std::string PrependName(const std::string& s) const { return "spending key" + s; }
|
||||
|
||||
public:
|
||||
bool Set(const libzcash::SpendingKey& addr);
|
||||
CZCSpendingKey() {}
|
||||
|
||||
CZCSpendingKey(const std::string& strAddress) { SetString(strAddress.c_str(), 2); }
|
||||
CZCSpendingKey(const libzcash::SpendingKey& addr) { Set(addr); }
|
||||
|
||||
libzcash::SpendingKey Get() const;
|
||||
};
|
||||
|
||||
/** base58-encoded Bitcoin addresses.
|
||||
@@ -172,7 +194,7 @@ public:
|
||||
K GetKey() {
|
||||
K ret;
|
||||
if (vchData.size() == Size) {
|
||||
//if base58 encouded data not holds a ext key, return a !IsValid() key
|
||||
//if base58 encoded data not holds a ext key, return a !IsValid() key
|
||||
ret.Decode(&vchData[0]);
|
||||
}
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user