Add Sapling have/get sk crypter overrides
This commit is contained in:
@@ -6,6 +6,9 @@
|
||||
|
||||
#include <librustzcash.h>
|
||||
|
||||
const unsigned char ZCASH_SAPLING_FVFP_PERSONALIZATION[crypto_generichash_blake2b_PERSONALBYTES] =
|
||||
{'Z', 'c', 'a', 's', 'h', 'S', 'a', 'p', 'l', 'i', 'n', 'g', 'F', 'V', 'F', 'P'};
|
||||
|
||||
namespace libzcash {
|
||||
|
||||
uint256 SproutPaymentAddress::GetHash() const {
|
||||
@@ -73,6 +76,13 @@ bool SaplingFullViewingKey::is_valid() const {
|
||||
return !ivk.IsNull();
|
||||
}
|
||||
|
||||
uint256 SaplingFullViewingKey::GetFingerprint() const {
|
||||
CBLAKE2bWriter ss(SER_GETHASH, 0, ZCASH_SAPLING_FVFP_PERSONALIZATION);
|
||||
ss << *this;
|
||||
return ss.GetHash();
|
||||
}
|
||||
|
||||
|
||||
SaplingSpendingKey SaplingSpendingKey::random() {
|
||||
while (true) {
|
||||
auto sk = SaplingSpendingKey(random_uint256());
|
||||
|
||||
@@ -19,6 +19,8 @@ const size_t SerializedPaymentAddressSize = 64;
|
||||
const size_t SerializedViewingKeySize = 64;
|
||||
const size_t SerializedSpendingKeySize = 32;
|
||||
|
||||
const size_t SerializedSaplingSpendingKeySize = 32;
|
||||
|
||||
typedef std::array<unsigned char, ZC_DIVERSIFIER_SIZE> diversifier_t;
|
||||
|
||||
class SproutPaymentAddress {
|
||||
@@ -146,12 +148,15 @@ public:
|
||||
ADD_SERIALIZE_METHODS;
|
||||
|
||||
template <typename Stream, typename Operation>
|
||||
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
|
||||
inline void SerializationOp(Stream& s, Operation ser_action) {
|
||||
READWRITE(ak);
|
||||
READWRITE(nk);
|
||||
READWRITE(ovk);
|
||||
}
|
||||
|
||||
//! Get the fingerprint of this full viewing key (as defined in ZIP 32).
|
||||
uint256 GetFingerprint() const;
|
||||
|
||||
SaplingIncomingViewingKey in_viewing_key() const;
|
||||
bool is_valid() const;
|
||||
|
||||
@@ -178,7 +183,7 @@ public:
|
||||
ADD_SERIALIZE_METHODS;
|
||||
|
||||
template <typename Stream, typename Operation>
|
||||
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
|
||||
inline void SerializationOp(Stream& s, Operation ser_action) {
|
||||
READWRITE(ask);
|
||||
READWRITE(nsk);
|
||||
READWRITE(ovk);
|
||||
|
||||
Reference in New Issue
Block a user