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:
@@ -34,7 +34,7 @@ uint256 SproutNote::cm() const {
|
||||
return result;
|
||||
}
|
||||
|
||||
uint256 SproutNote::nullifier(const SpendingKey& a_sk) const {
|
||||
uint256 SproutNote::nullifier(const SproutSpendingKey& a_sk) const {
|
||||
return PRF_nf(a_sk, rho);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ SproutNotePlaintext::SproutNotePlaintext(
|
||||
r = note.r;
|
||||
}
|
||||
|
||||
SproutNote SproutNotePlaintext::note(const PaymentAddress& addr) const
|
||||
SproutNote SproutNotePlaintext::note(const SproutPaymentAddress& addr) const
|
||||
{
|
||||
return SproutNote(addr.a_pk, value_, rho, r);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user