desprout
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or https://www.opensource.org/licenses/mit-license.php
|
||||
|
||||
#include "Address.hpp"
|
||||
#include "NoteEncryption.hpp"
|
||||
#include "hash.h"
|
||||
@@ -13,36 +17,6 @@ const uint32_t SAPLING_BRANCH_ID = 0x76b809bb;
|
||||
|
||||
namespace libzcash {
|
||||
|
||||
uint256 SproutPaymentAddress::GetHash() const {
|
||||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
||||
ss << *this;
|
||||
return Hash(ss.begin(), ss.end());
|
||||
}
|
||||
|
||||
uint256 ReceivingKey::pk_enc() const {
|
||||
return ZCNoteEncryption::generate_pubkey(*this);
|
||||
}
|
||||
|
||||
SproutPaymentAddress SproutViewingKey::address() const {
|
||||
return SproutPaymentAddress(a_pk, sk_enc.pk_enc());
|
||||
}
|
||||
|
||||
ReceivingKey SproutSpendingKey::receiving_key() const {
|
||||
return ReceivingKey(ZCNoteEncryption::generate_privkey(*this));
|
||||
}
|
||||
|
||||
SproutViewingKey SproutSpendingKey::viewing_key() const {
|
||||
return SproutViewingKey(PRF_addr_a_pk(*this), receiving_key());
|
||||
}
|
||||
|
||||
SproutSpendingKey SproutSpendingKey::random() {
|
||||
return SproutSpendingKey(random_uint252());
|
||||
}
|
||||
|
||||
SproutPaymentAddress SproutSpendingKey::address() const {
|
||||
return viewing_key().address();
|
||||
}
|
||||
|
||||
//! Sapling
|
||||
uint256 SaplingPaymentAddress::GetHash() const {
|
||||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
||||
@@ -119,10 +93,6 @@ class IsValidAddressForNetwork : public boost::static_visitor<bool> {
|
||||
public:
|
||||
IsValidAddressForNetwork(uint32_t consensusBranchId) : branchId(consensusBranchId) {}
|
||||
|
||||
bool operator()(const libzcash::SproutPaymentAddress &addr) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool operator()(const libzcash::InvalidEncoding &addr) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user