Fix naming of unified spending & full viewing keys
This commit is contained in:
parent
cd01b2d9bf
commit
87f7e5fbba
|
@ -406,7 +406,7 @@ bool CWallet::AddCryptedSaplingSpendingKey(const libzcash::SaplingExtendedFullVi
|
|||
return false;
|
||||
}
|
||||
|
||||
UnifiedSpendingKey CWallet::GenerateNewUnifiedSpendingKey() {
|
||||
ZcashdUnifiedSpendingKey CWallet::GenerateNewUnifiedSpendingKey() {
|
||||
AssertLockHeld(cs_wallet);
|
||||
|
||||
CHDChain& hdChain = mnemonicHDChain.value();
|
||||
|
@ -426,13 +426,13 @@ UnifiedSpendingKey CWallet::GenerateNewUnifiedSpendingKey() {
|
|||
}
|
||||
}
|
||||
|
||||
std::optional<libzcash::UnifiedSpendingKey> CWallet::GenerateUnifiedSpendingKeyForAccount(uint32_t accountId) {
|
||||
std::optional<libzcash::ZcashdUnifiedSpendingKey> CWallet::GenerateUnifiedSpendingKeyForAccount(uint32_t accountId) {
|
||||
auto seed = GetMnemonicSeed();
|
||||
if (!seed.has_value()) {
|
||||
throw std::runtime_error(std::string(__func__) + ": Wallet has no mnemonic HD seed. Please upgrade this wallet.");
|
||||
}
|
||||
|
||||
auto usk = UnifiedSpendingKey::ForAccount(seed.value(), BIP44CoinType(), accountId);
|
||||
auto usk = ZcashdUnifiedSpendingKey::ForAccount(seed.value(), BIP44CoinType(), accountId);
|
||||
if (usk.has_value()) {
|
||||
// TODO: Save the unified full viewing key & metadata to the wallet
|
||||
|
||||
|
|
|
@ -1096,8 +1096,8 @@ public:
|
|||
/**
|
||||
* Unified keys & addresses
|
||||
*/
|
||||
libzcash::UnifiedSpendingKey GenerateNewUnifiedSpendingKey();
|
||||
std::optional<libzcash::UnifiedSpendingKey> GenerateUnifiedSpendingKeyForAccount(uint32_t accountId);
|
||||
libzcash::ZcashdUnifiedSpendingKey GenerateNewUnifiedSpendingKey();
|
||||
std::optional<libzcash::ZcashdUnifiedSpendingKey> GenerateUnifiedSpendingKeyForAccount(uint32_t accountId);
|
||||
|
||||
/**
|
||||
* Increment the next transaction order id
|
||||
|
|
|
@ -38,7 +38,7 @@ MnemonicSeed MnemonicSeed::Random(uint32_t bip44CoinType, Language language, siz
|
|||
// account 0x7FFFFFFF because derivation via the legacy path can simply search
|
||||
// for a valid diversifier; unlike in the unified spending key case, diversifier
|
||||
// indices don't need to line up with anything.
|
||||
if (libzcash::UnifiedSpendingKey::ForAccount(seed, bip44CoinType, 0).has_value() &&
|
||||
if (libzcash::ZcashdUnifiedSpendingKey::ForAccount(seed, bip44CoinType, 0).has_value() &&
|
||||
libzcash::Bip44AccountChains::ForAccount(seed, bip44CoinType, ZCASH_LEGACY_ACCOUNT).has_value()) {
|
||||
return seed;
|
||||
}
|
||||
|
@ -301,8 +301,8 @@ SaplingExtendedFullViewingKey SaplingExtendedSpendingKey::ToXFVK() const
|
|||
// Unified
|
||||
//
|
||||
|
||||
std::optional<std::pair<UnifiedSpendingKey, HDKeyPath>> UnifiedSpendingKey::ForAccount(const HDSeed& seed, uint32_t bip44CoinType, uint32_t accountId) {
|
||||
UnifiedSpendingKey usk;
|
||||
std::optional<std::pair<ZcashdUnifiedSpendingKey, HDKeyPath>> ZcashdUnifiedSpendingKey::ForAccount(const HDSeed& seed, uint32_t bip44CoinType, uint32_t accountId) {
|
||||
ZcashdUnifiedSpendingKey usk;
|
||||
usk.accountId = accountId;
|
||||
|
||||
auto transparentKey = DeriveBip44TransparentAccountKey(seed, bip44CoinType, accountId);
|
||||
|
@ -315,8 +315,8 @@ std::optional<std::pair<UnifiedSpendingKey, HDKeyPath>> UnifiedSpendingKey::ForA
|
|||
return std::make_pair(usk, saplingKey.second);
|
||||
}
|
||||
|
||||
UnifiedFullViewingKey UnifiedSpendingKey::ToFullViewingKey() const {
|
||||
UnifiedFullViewingKey ufvk;
|
||||
ZcashdUnifiedFullViewingKey ZcashdUnifiedSpendingKey::ToFullViewingKey() const {
|
||||
ZcashdUnifiedFullViewingKey ufvk;
|
||||
|
||||
if (transparentKey.has_value()) {
|
||||
ufvk.transparentKey = transparentKey.value().Neuter();
|
||||
|
@ -329,7 +329,7 @@ UnifiedFullViewingKey UnifiedSpendingKey::ToFullViewingKey() const {
|
|||
return ufvk;
|
||||
}
|
||||
|
||||
std::optional<ZcashdUnifiedAddress> UnifiedFullViewingKey::Address(diversifier_index_t j) const {
|
||||
std::optional<ZcashdUnifiedAddress> ZcashdUnifiedFullViewingKey::Address(diversifier_index_t j) const {
|
||||
ZcashdUnifiedAddress ua;
|
||||
|
||||
if (transparentKey.has_value()) {
|
||||
|
|
|
@ -306,8 +306,8 @@ struct SaplingExtendedSpendingKey {
|
|||
}
|
||||
};
|
||||
|
||||
class UnifiedSpendingKey;
|
||||
class UnifiedFullViewingKey;
|
||||
class ZcashdUnifiedSpendingKey;
|
||||
class ZcashdUnifiedFullViewingKey;
|
||||
|
||||
class ZcashdUnifiedAddress {
|
||||
private:
|
||||
|
@ -315,7 +315,7 @@ private:
|
|||
std::optional<CPubKey> transparentKey; //TODO: should this just be the public key hash?
|
||||
std::optional<SaplingPaymentAddress> saplingAddress;
|
||||
|
||||
friend class UnifiedFullViewingKey;
|
||||
friend class ZcashdUnifiedFullViewingKey;
|
||||
|
||||
ZcashdUnifiedAddress() {}
|
||||
public:
|
||||
|
@ -328,14 +328,14 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class UnifiedFullViewingKey {
|
||||
class ZcashdUnifiedFullViewingKey {
|
||||
private:
|
||||
std::optional<CExtPubKey> transparentKey;
|
||||
std::optional<SaplingExtendedFullViewingKey> saplingKey;
|
||||
|
||||
UnifiedFullViewingKey() {}
|
||||
ZcashdUnifiedFullViewingKey() {}
|
||||
|
||||
friend class UnifiedSpendingKey;
|
||||
friend class ZcashdUnifiedSpendingKey;
|
||||
public:
|
||||
const std::optional<CExtPubKey>& GetTransparentKey() const {
|
||||
return transparentKey;
|
||||
|
@ -358,15 +358,15 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class UnifiedSpendingKey {
|
||||
class ZcashdUnifiedSpendingKey {
|
||||
private:
|
||||
uint32_t accountId;
|
||||
std::optional<CExtKey> transparentKey;
|
||||
std::optional<SaplingExtendedSpendingKey> saplingKey;
|
||||
|
||||
UnifiedSpendingKey() {}
|
||||
ZcashdUnifiedSpendingKey() {}
|
||||
public:
|
||||
static std::optional<std::pair<UnifiedSpendingKey, HDKeyPath>> ForAccount(
|
||||
static std::optional<std::pair<ZcashdUnifiedSpendingKey, HDKeyPath>> ForAccount(
|
||||
const HDSeed& seed,
|
||||
uint32_t bip44CoinType,
|
||||
uint32_t accountId);
|
||||
|
@ -379,7 +379,7 @@ public:
|
|||
return saplingKey;
|
||||
}
|
||||
|
||||
UnifiedFullViewingKey ToFullViewingKey() const;
|
||||
ZcashdUnifiedFullViewingKey ToFullViewingKey() const;
|
||||
};
|
||||
|
||||
std::optional<unsigned long> ParseZip32KeypathAccount(const std::string& keyPath);
|
||||
|
|
Loading…
Reference in New Issue