Use boost::variant to represent shielded addresses and keys
libzcash::PaymentAddress has been renamed to libzcash::SproutPaymentAddress, and a new typedef boost::variant is now libzcash::PaymentAddress. Similarly for ViewingKey and SpendingKey. A new class InvalidEncoding is introduced as the default boost::variant option for each address and key type; it is used during decoding instead of boost::optional. All address and key storage functions in the wallet have been modified to refer specifically to the Sprout types, as they are used very precisely. In most other cases, the more general type is leveraged as much as possible, and we convert to the Sprout type when necessary. This will be subsequently wrapped in, or replaced with, context-specific functions once Sapling types are implemented.
This commit is contained in:
@@ -29,12 +29,13 @@ bool IsValidDestinationString(const std::string& str);
|
||||
bool IsValidDestinationString(const std::string& str, const CChainParams& params);
|
||||
|
||||
std::string EncodePaymentAddress(const libzcash::PaymentAddress& zaddr);
|
||||
boost::optional<libzcash::PaymentAddress> DecodePaymentAddress(const std::string& str);
|
||||
libzcash::PaymentAddress DecodePaymentAddress(const std::string& str);
|
||||
bool IsValidPaymentAddressString(const std::string& str);
|
||||
|
||||
std::string EncodeViewingKey(const libzcash::ViewingKey& vk);
|
||||
boost::optional<libzcash::ViewingKey> DecodeViewingKey(const std::string& str);
|
||||
libzcash::ViewingKey DecodeViewingKey(const std::string& str);
|
||||
|
||||
std::string EncodeSpendingKey(const libzcash::SpendingKey& zkey);
|
||||
boost::optional<libzcash::SpendingKey> DecodeSpendingKey(const std::string& str);
|
||||
libzcash::SpendingKey DecodeSpendingKey(const std::string& str);
|
||||
|
||||
#endif // BITCOIN_KEYIO_H
|
||||
|
||||
Reference in New Issue
Block a user