Rename AddSaplingIncomingViewingKey -> AddSaplingPaymentAddress
This operation was poorly named; the wallet already contained the IVK, and this operation was simply adding the ability to look up the IVK by a specific diversified address derived from that IVK.
This commit is contained in:
parent
b80349d246
commit
66530d97e1
|
@ -557,7 +557,7 @@ TEST(KeystoreTests, StoreAndRetrieveUFVK) {
|
|||
EXPECT_FALSE(ufvkmeta.has_value());
|
||||
|
||||
auto saplingIvk = zufvk.GetSaplingKey().value().fvk.in_viewing_key();
|
||||
keyStore.AddSaplingIncomingViewingKey(saplingIvk, saplingReceiver);
|
||||
keyStore.AddSaplingPaymentAddress(saplingIvk, saplingReceiver);
|
||||
|
||||
ufvkmeta = keyStore.GetUFVKMetadataForReceiver(saplingReceiver);
|
||||
EXPECT_TRUE(ufvkmeta.has_value());
|
||||
|
|
|
@ -196,13 +196,13 @@ bool CBasicKeyStore::AddSaplingFullViewingKey(
|
|||
auto ivk = extfvk.fvk.in_viewing_key();
|
||||
mapSaplingFullViewingKeys[ivk] = extfvk;
|
||||
|
||||
return CBasicKeyStore::AddSaplingIncomingViewingKey(ivk, extfvk.DefaultAddress());
|
||||
return CBasicKeyStore::AddSaplingPaymentAddress(ivk, extfvk.DefaultAddress());
|
||||
}
|
||||
|
||||
// This function updates the wallet's internal address->ivk map.
|
||||
// If we add an address that is already in the map, the map will
|
||||
// remain unchanged as each address only has one ivk.
|
||||
bool CBasicKeyStore::AddSaplingIncomingViewingKey(
|
||||
bool CBasicKeyStore::AddSaplingPaymentAddress(
|
||||
const libzcash::SaplingIncomingViewingKey &ivk,
|
||||
const libzcash::SaplingPaymentAddress &addr)
|
||||
{
|
||||
|
|
|
@ -86,8 +86,8 @@ public:
|
|||
const libzcash::SaplingIncomingViewingKey &ivk,
|
||||
libzcash::SaplingExtendedFullViewingKey& extfvkOut) const =0;
|
||||
|
||||
//! Sapling incoming viewing keys
|
||||
virtual bool AddSaplingIncomingViewingKey(
|
||||
//! Sapling payment addresses & incoming viewing keys
|
||||
virtual bool AddSaplingPaymentAddress(
|
||||
const libzcash::SaplingIncomingViewingKey &ivk,
|
||||
const libzcash::SaplingPaymentAddress &addr) =0;
|
||||
virtual bool HaveSaplingIncomingViewingKey(const libzcash::SaplingPaymentAddress &addr) const =0;
|
||||
|
@ -324,7 +324,7 @@ public:
|
|||
const libzcash::SaplingIncomingViewingKey &ivk,
|
||||
libzcash::SaplingExtendedFullViewingKey& extfvkOut) const;
|
||||
|
||||
virtual bool AddSaplingIncomingViewingKey(
|
||||
virtual bool AddSaplingPaymentAddress(
|
||||
const libzcash::SaplingIncomingViewingKey &ivk,
|
||||
const libzcash::SaplingPaymentAddress &addr);
|
||||
virtual bool HaveSaplingIncomingViewingKey(const libzcash::SaplingPaymentAddress &addr) const;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
* This test covers Sapling methods on CWallet
|
||||
* GenerateNewLegacySaplingZKey()
|
||||
* AddSaplingZKey()
|
||||
* AddSaplingIncomingViewingKey()
|
||||
* AddSaplingPaymentAddress()
|
||||
* LoadSaplingZKey()
|
||||
* LoadSaplingIncomingViewingKey()
|
||||
* LoadSaplingZKeyMetadata()
|
||||
|
@ -77,7 +77,7 @@ TEST(WalletZkeysTest, StoreAndLoadSaplingZkeys) {
|
|||
|
||||
// manually add a diversified address
|
||||
auto ivk = extfvk.fvk.in_viewing_key();
|
||||
EXPECT_TRUE(wallet.AddSaplingIncomingViewingKey(ivk, dpa));
|
||||
EXPECT_TRUE(wallet.AddSaplingPaymentAddress(ivk, dpa));
|
||||
|
||||
// verify wallet did add it
|
||||
EXPECT_TRUE(wallet.HaveSaplingIncomingViewingKey(sk.ToXFVK().DefaultAddress()));
|
||||
|
@ -454,7 +454,7 @@ TEST(WalletZkeysTest, WriteCryptedSaplingZkeyDirectToDb) {
|
|||
|
||||
// Add diversified address to the wallet
|
||||
auto ivk = extsk.expsk.full_viewing_key().in_viewing_key();
|
||||
EXPECT_TRUE(wallet.AddSaplingIncomingViewingKey(ivk, dpa));
|
||||
EXPECT_TRUE(wallet.AddSaplingPaymentAddress(ivk, dpa));
|
||||
|
||||
// encrypt wallet
|
||||
SecureString strWalletPass;
|
||||
|
|
|
@ -169,6 +169,7 @@ std::pair<SaplingPaymentAddress, bool> CWallet::GenerateLegacySaplingZKey(uint32
|
|||
if (!AddSaplingZKey(xsk.first)) {
|
||||
throw std::runtime_error("CWallet::GenerateLegacySaplingZKey(): AddSaplingZKey failed.");
|
||||
}
|
||||
|
||||
return std::make_pair(extfvk.DefaultAddress(), true) ;
|
||||
} else {
|
||||
return std::make_pair(extfvk.DefaultAddress(), false);
|
||||
|
@ -212,13 +213,13 @@ bool CWallet::AddSaplingFullViewingKey(const libzcash::SaplingExtendedFullViewin
|
|||
}
|
||||
|
||||
// Add payment address -> incoming viewing key map entry
|
||||
bool CWallet::AddSaplingIncomingViewingKey(
|
||||
bool CWallet::AddSaplingPaymentAddress(
|
||||
const libzcash::SaplingIncomingViewingKey &ivk,
|
||||
const libzcash::SaplingPaymentAddress &addr)
|
||||
{
|
||||
AssertLockHeld(cs_wallet); // mapSaplingZKeyMetadata
|
||||
|
||||
if (!CCryptoKeyStore::AddSaplingIncomingViewingKey(ivk, addr)) {
|
||||
if (!CCryptoKeyStore::AddSaplingPaymentAddress(ivk, addr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -833,7 +834,7 @@ bool CWallet::LoadSaplingPaymentAddress(
|
|||
const libzcash::SaplingPaymentAddress &addr,
|
||||
const libzcash::SaplingIncomingViewingKey &ivk)
|
||||
{
|
||||
return CCryptoKeyStore::AddSaplingIncomingViewingKey(ivk, addr);
|
||||
return CCryptoKeyStore::AddSaplingPaymentAddress(ivk, addr);
|
||||
}
|
||||
|
||||
bool CWallet::LoadZKey(const libzcash::SproutSpendingKey &key)
|
||||
|
@ -2566,7 +2567,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
|
|||
auto saplingNoteData = saplingNoteDataAndAddressesToAdd.first;
|
||||
auto addressesToAdd = saplingNoteDataAndAddressesToAdd.second;
|
||||
for (const auto &addressToAdd : addressesToAdd) {
|
||||
if (!AddSaplingIncomingViewingKey(addressToAdd.second, addressToAdd.first)) {
|
||||
if (!AddSaplingPaymentAddress(addressToAdd.second, addressToAdd.first)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1383,7 +1383,7 @@ public:
|
|||
//! full viewing key to the keystore, to avoid this override.
|
||||
bool AddSaplingFullViewingKey(
|
||||
const libzcash::SaplingExtendedFullViewingKey &extfvk);
|
||||
bool AddSaplingIncomingViewingKey(
|
||||
bool AddSaplingPaymentAddress(
|
||||
const libzcash::SaplingIncomingViewingKey &ivk,
|
||||
const libzcash::SaplingPaymentAddress &addr);
|
||||
bool AddCryptedSaplingSpendingKey(
|
||||
|
|
Loading…
Reference in New Issue