Add various bits of documentation

This commit is contained in:
Kris Nuttycombe 2021-10-26 15:10:09 -06:00 committed by Jack Grigg
parent 98ab4bcadb
commit 3e3ee1bf3b
4 changed files with 19 additions and 3 deletions

View File

@ -252,6 +252,10 @@ bool CBasicKeyStore::GetSproutViewingKey(
return false; return false;
} }
//
// Sapling Keys
//
bool CBasicKeyStore::GetSaplingFullViewingKey( bool CBasicKeyStore::GetSaplingFullViewingKey(
const libzcash::SaplingIncomingViewingKey &ivk, const libzcash::SaplingIncomingViewingKey &ivk,
libzcash::SaplingExtendedFullViewingKey &extfvkOut) const libzcash::SaplingExtendedFullViewingKey &extfvkOut) const

View File

@ -725,8 +725,9 @@ WalletUAGenerationResult CWallet::GenerateUnifiedAddress(
assert(mapUfvkAddressMetadata[ufvkid].SetReceivers(address.second, receiverTypes)); assert(mapUfvkAddressMetadata[ufvkid].SetReceivers(address.second, receiverTypes));
if (hasTransparent) { if (hasTransparent) {
// We must construct and add the transparent spending key associated // We must construct and add the transparent spending key associated
// with the external transparent child address to the transparent // with the external and internal transparent child addresses to the
// keystore. // transparent keystore. This call to `value` will succeed because
// this key must have been previously generated.
auto usk = GenerateUnifiedSpendingKeyForAccount(accountId).value(); auto usk = GenerateUnifiedSpendingKeyForAccount(accountId).value();
auto accountKey = usk.GetTransparentKey(); auto accountKey = usk.GetTransparentKey();
// this .value is known to be safe from the earlier check // this .value is known to be safe from the earlier check
@ -6425,6 +6426,9 @@ std::optional<libzcash::ViewingKey> GetViewingKeyForPaymentAddress::operator()(
{ {
return std::nullopt; return std::nullopt;
} }
// GetViewingKeyForPaymentAddress visitor
std::optional<libzcash::ViewingKey> GetViewingKeyForPaymentAddress::operator()( std::optional<libzcash::ViewingKey> GetViewingKeyForPaymentAddress::operator()(
const libzcash::SproutPaymentAddress &zaddr) const const libzcash::SproutPaymentAddress &zaddr) const
{ {

View File

@ -1816,6 +1816,7 @@ public:
// Shielded key and address generalizations // Shielded key and address generalizations
// //
// PaymentAddressBelongsToWallet visitor :: (CWallet&, PaymentAddress) -> bool
class PaymentAddressBelongsToWallet class PaymentAddressBelongsToWallet
{ {
private: private:
@ -1830,6 +1831,7 @@ public:
bool operator()(const libzcash::UnifiedAddress &uaddr) const; bool operator()(const libzcash::UnifiedAddress &uaddr) const;
}; };
// GetViewingKeyForPaymentAddress visitor :: (CWallet&, PaymentAddress) -> std::optional<ViewingKey>
class GetViewingKeyForPaymentAddress class GetViewingKeyForPaymentAddress
{ {
private: private:
@ -1853,6 +1855,7 @@ enum class PaymentAddressSource {
AddressNotFound, AddressNotFound,
}; };
// GetSourceForPaymentAddress visitor :: (CWallet&, PaymentAddress) -> PaymentAddressSource
class GetSourceForPaymentAddress class GetSourceForPaymentAddress
{ {
private: private:
@ -1876,6 +1879,7 @@ enum KeyAddResult {
KeyNotAdded, KeyNotAdded,
}; };
// AddViewingKeyToWallet visitor :: (CWallet&, ViewingKey) -> KeyAddResult
class AddViewingKeyToWallet class AddViewingKeyToWallet
{ {
private: private:
@ -1889,6 +1893,8 @@ public:
KeyAddResult operator()(const libzcash::UnifiedFullViewingKey &sk) const; KeyAddResult operator()(const libzcash::UnifiedFullViewingKey &sk) const;
}; };
// AddSpendingKeyToWallet visitor ::
// (CWallet&, Consensus::Params, ..., ViewingKey) -> KeyAddResult
class AddSpendingKeyToWallet class AddSpendingKeyToWallet
{ {
private: private:
@ -1917,6 +1923,7 @@ public:
KeyAddResult operator()(const libzcash::SaplingExtendedSpendingKey &sk) const; KeyAddResult operator()(const libzcash::SaplingExtendedSpendingKey &sk) const;
}; };
// UFVKForReceiver :: (CWallet&, Receiver) -> std::optional<ZcashdUnifiedFullViewingKey>
class UFVKForReceiver { class UFVKForReceiver {
private: private:
const CWallet& wallet; const CWallet& wallet;
@ -1930,6 +1937,7 @@ public:
std::optional<libzcash::ZcashdUnifiedFullViewingKey> operator()(const libzcash::UnknownReceiver& receiver) const; std::optional<libzcash::ZcashdUnifiedFullViewingKey> operator()(const libzcash::UnknownReceiver& receiver) const;
}; };
// UnifiedAddressForReceiver :: (CWallet&, Receiver) -> std::optional<UnifiedAddress>
class UnifiedAddressForReceiver { class UnifiedAddressForReceiver {
private: private:
const CWallet& wallet; const CWallet& wallet;

View File

@ -295,4 +295,4 @@ bool IsInternalKeyPath(uint32_t purpose, uint32_t coinType, const std::string& k
} }
} }
}; } //namespace libzcash