diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 539ae3009..ff0d81324 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -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 CWallet::GenerateUnifiedSpendingKeyForAccount(uint32_t accountId) { +std::optional 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 diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 5f8b9f501..38c2e5c83 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1096,8 +1096,8 @@ public: /** * Unified keys & addresses */ - libzcash::UnifiedSpendingKey GenerateNewUnifiedSpendingKey(); - std::optional GenerateUnifiedSpendingKeyForAccount(uint32_t accountId); + libzcash::ZcashdUnifiedSpendingKey GenerateNewUnifiedSpendingKey(); + std::optional GenerateUnifiedSpendingKeyForAccount(uint32_t accountId); /** * Increment the next transaction order id diff --git a/src/zcash/address/zip32.cpp b/src/zcash/address/zip32.cpp index b0030f452..e1b0480b6 100644 --- a/src/zcash/address/zip32.cpp +++ b/src/zcash/address/zip32.cpp @@ -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> UnifiedSpendingKey::ForAccount(const HDSeed& seed, uint32_t bip44CoinType, uint32_t accountId) { - UnifiedSpendingKey usk; +std::optional> 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> 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 UnifiedFullViewingKey::Address(diversifier_index_t j) const { +std::optional ZcashdUnifiedFullViewingKey::Address(diversifier_index_t j) const { ZcashdUnifiedAddress ua; if (transparentKey.has_value()) { diff --git a/src/zcash/address/zip32.h b/src/zcash/address/zip32.h index 16394a6eb..365c3654f 100644 --- a/src/zcash/address/zip32.h +++ b/src/zcash/address/zip32.h @@ -306,8 +306,8 @@ struct SaplingExtendedSpendingKey { } }; -class UnifiedSpendingKey; -class UnifiedFullViewingKey; +class ZcashdUnifiedSpendingKey; +class ZcashdUnifiedFullViewingKey; class ZcashdUnifiedAddress { private: @@ -315,7 +315,7 @@ private: std::optional transparentKey; //TODO: should this just be the public key hash? std::optional saplingAddress; - friend class UnifiedFullViewingKey; + friend class ZcashdUnifiedFullViewingKey; ZcashdUnifiedAddress() {} public: @@ -328,14 +328,14 @@ public: } }; -class UnifiedFullViewingKey { +class ZcashdUnifiedFullViewingKey { private: std::optional transparentKey; std::optional saplingKey; - UnifiedFullViewingKey() {} + ZcashdUnifiedFullViewingKey() {} - friend class UnifiedSpendingKey; + friend class ZcashdUnifiedSpendingKey; public: const std::optional& GetTransparentKey() const { return transparentKey; @@ -358,15 +358,15 @@ public: } }; -class UnifiedSpendingKey { +class ZcashdUnifiedSpendingKey { private: uint32_t accountId; std::optional transparentKey; std::optional saplingKey; - UnifiedSpendingKey() {} + ZcashdUnifiedSpendingKey() {} public: - static std::optional> ForAccount( + static std::optional> 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 ParseZip32KeypathAccount(const std::string& keyPath);