Rename *SpendingKey -> *SproutSpendingKey

Also GetPaymentAddresses -> GetSproutPaymentAddresses
This commit is contained in:
Jack Grigg 2018-08-03 10:10:26 +01:00
parent f84cf5f817
commit 25d5e80cbe
No known key found for this signature in database
GPG Key ID: 1B8D649257DB0829
15 changed files with 149 additions and 143 deletions

View File

@ -72,22 +72,22 @@ TEST(keystore_tests, store_and_retrieve_spending_key) {
libzcash::SproutSpendingKey skOut;
std::set<libzcash::SproutPaymentAddress> addrs;
keyStore.GetPaymentAddresses(addrs);
keyStore.GetSproutPaymentAddresses(addrs);
EXPECT_EQ(0, addrs.size());
auto sk = libzcash::SproutSpendingKey::random();
auto addr = sk.address();
// Sanity-check: we can't get a key we haven't added
EXPECT_FALSE(keyStore.HaveSpendingKey(addr));
EXPECT_FALSE(keyStore.GetSpendingKey(addr, skOut));
EXPECT_FALSE(keyStore.HaveSproutSpendingKey(addr));
EXPECT_FALSE(keyStore.GetSproutSpendingKey(addr, skOut));
keyStore.AddSpendingKey(sk);
EXPECT_TRUE(keyStore.HaveSpendingKey(addr));
EXPECT_TRUE(keyStore.GetSpendingKey(addr, skOut));
keyStore.AddSproutSpendingKey(sk);
EXPECT_TRUE(keyStore.HaveSproutSpendingKey(addr));
EXPECT_TRUE(keyStore.GetSproutSpendingKey(addr, skOut));
EXPECT_EQ(sk, skOut);
keyStore.GetPaymentAddresses(addrs);
keyStore.GetSproutPaymentAddresses(addrs);
EXPECT_EQ(1, addrs.size());
EXPECT_EQ(1, addrs.count(addr));
}
@ -101,7 +101,7 @@ TEST(keystore_tests, store_and_retrieve_note_decryptor) {
EXPECT_FALSE(keyStore.GetNoteDecryptor(addr, decOut));
keyStore.AddSpendingKey(sk);
keyStore.AddSproutSpendingKey(sk);
EXPECT_TRUE(keyStore.GetNoteDecryptor(addr, decOut));
EXPECT_EQ(ZCNoteDecryption(sk.receiving_key()), decOut);
}
@ -121,13 +121,13 @@ TEST(keystore_tests, StoreAndRetrieveViewingKey) {
EXPECT_FALSE(keyStore.GetSproutViewingKey(addr, vkOut));
// and we shouldn't have a spending key or decryptor either
EXPECT_FALSE(keyStore.HaveSpendingKey(addr));
EXPECT_FALSE(keyStore.GetSpendingKey(addr, skOut));
EXPECT_FALSE(keyStore.HaveSproutSpendingKey(addr));
EXPECT_FALSE(keyStore.GetSproutSpendingKey(addr, skOut));
EXPECT_FALSE(keyStore.GetNoteDecryptor(addr, decOut));
// and we can't find it in our list of addresses
std::set<libzcash::SproutPaymentAddress> addresses;
keyStore.GetPaymentAddresses(addresses);
keyStore.GetSproutPaymentAddresses(addresses);
EXPECT_FALSE(addresses.count(addr));
keyStore.AddSproutViewingKey(vk);
@ -136,8 +136,8 @@ TEST(keystore_tests, StoreAndRetrieveViewingKey) {
EXPECT_EQ(vk, vkOut);
// We should still not have the spending key...
EXPECT_FALSE(keyStore.HaveSpendingKey(addr));
EXPECT_FALSE(keyStore.GetSpendingKey(addr, skOut));
EXPECT_FALSE(keyStore.HaveSproutSpendingKey(addr));
EXPECT_FALSE(keyStore.GetSproutSpendingKey(addr, skOut));
// ... but we should have a decryptor
EXPECT_TRUE(keyStore.GetNoteDecryptor(addr, decOut));
@ -145,16 +145,16 @@ TEST(keystore_tests, StoreAndRetrieveViewingKey) {
// ... and we should find it in our list of addresses
addresses.clear();
keyStore.GetPaymentAddresses(addresses);
keyStore.GetSproutPaymentAddresses(addresses);
EXPECT_TRUE(addresses.count(addr));
keyStore.RemoveSproutViewingKey(vk);
EXPECT_FALSE(keyStore.HaveSproutViewingKey(addr));
EXPECT_FALSE(keyStore.GetSproutViewingKey(addr, vkOut));
EXPECT_FALSE(keyStore.HaveSpendingKey(addr));
EXPECT_FALSE(keyStore.GetSpendingKey(addr, skOut));
EXPECT_FALSE(keyStore.HaveSproutSpendingKey(addr));
EXPECT_FALSE(keyStore.GetSproutSpendingKey(addr, skOut));
addresses.clear();
keyStore.GetPaymentAddresses(addresses);
keyStore.GetSproutPaymentAddresses(addresses);
EXPECT_FALSE(addresses.count(addr));
// We still have a decryptor because those are cached in memory
@ -225,16 +225,16 @@ TEST(keystore_tests, store_and_retrieve_spending_key_in_encrypted_store) {
auto addr = sk.address();
EXPECT_FALSE(keyStore.GetNoteDecryptor(addr, decOut));
keyStore.AddSpendingKey(sk);
ASSERT_TRUE(keyStore.HaveSpendingKey(addr));
ASSERT_TRUE(keyStore.GetSpendingKey(addr, keyOut));
keyStore.AddSproutSpendingKey(sk);
ASSERT_TRUE(keyStore.HaveSproutSpendingKey(addr));
ASSERT_TRUE(keyStore.GetSproutSpendingKey(addr, keyOut));
ASSERT_EQ(sk, keyOut);
EXPECT_TRUE(keyStore.GetNoteDecryptor(addr, decOut));
EXPECT_EQ(ZCNoteDecryption(sk.receiving_key()), decOut);
ASSERT_TRUE(keyStore.EncryptKeys(vMasterKey));
ASSERT_TRUE(keyStore.HaveSpendingKey(addr));
ASSERT_FALSE(keyStore.GetSpendingKey(addr, keyOut));
ASSERT_TRUE(keyStore.HaveSproutSpendingKey(addr));
ASSERT_FALSE(keyStore.GetSproutSpendingKey(addr, keyOut));
EXPECT_TRUE(keyStore.GetNoteDecryptor(addr, decOut));
EXPECT_EQ(ZCNoteDecryption(sk.receiving_key()), decOut);
@ -250,10 +250,10 @@ TEST(keystore_tests, store_and_retrieve_spending_key_in_encrypted_store) {
// Unlocking with vMasterKey should succeed
ASSERT_TRUE(keyStore.Unlock(vMasterKey));
ASSERT_TRUE(keyStore.GetSpendingKey(addr, keyOut));
ASSERT_TRUE(keyStore.GetSproutSpendingKey(addr, keyOut));
ASSERT_EQ(sk, keyOut);
keyStore.GetPaymentAddresses(addrs);
keyStore.GetSproutPaymentAddresses(addrs);
ASSERT_EQ(1, addrs.size());
ASSERT_EQ(1, addrs.count(addr));
@ -262,26 +262,26 @@ TEST(keystore_tests, store_and_retrieve_spending_key_in_encrypted_store) {
auto addr2 = sk2.address();
EXPECT_FALSE(keyStore.GetNoteDecryptor(addr2, decOut));
keyStore.AddSpendingKey(sk2);
ASSERT_TRUE(keyStore.HaveSpendingKey(addr2));
ASSERT_TRUE(keyStore.GetSpendingKey(addr2, keyOut));
keyStore.AddSproutSpendingKey(sk2);
ASSERT_TRUE(keyStore.HaveSproutSpendingKey(addr2));
ASSERT_TRUE(keyStore.GetSproutSpendingKey(addr2, keyOut));
ASSERT_EQ(sk2, keyOut);
EXPECT_TRUE(keyStore.GetNoteDecryptor(addr2, decOut));
EXPECT_EQ(ZCNoteDecryption(sk2.receiving_key()), decOut);
ASSERT_TRUE(keyStore.Lock());
ASSERT_TRUE(keyStore.HaveSpendingKey(addr2));
ASSERT_FALSE(keyStore.GetSpendingKey(addr2, keyOut));
ASSERT_TRUE(keyStore.HaveSproutSpendingKey(addr2));
ASSERT_FALSE(keyStore.GetSproutSpendingKey(addr2, keyOut));
EXPECT_TRUE(keyStore.GetNoteDecryptor(addr2, decOut));
EXPECT_EQ(ZCNoteDecryption(sk2.receiving_key()), decOut);
ASSERT_TRUE(keyStore.Unlock(vMasterKey));
ASSERT_TRUE(keyStore.GetSpendingKey(addr2, keyOut));
ASSERT_TRUE(keyStore.GetSproutSpendingKey(addr2, keyOut));
ASSERT_EQ(sk2, keyOut);
EXPECT_TRUE(keyStore.GetNoteDecryptor(addr2, decOut));
EXPECT_EQ(ZCNoteDecryption(sk2.receiving_key()), decOut);
keyStore.GetPaymentAddresses(addrs);
keyStore.GetSproutPaymentAddresses(addrs);
ASSERT_EQ(2, addrs.size());
ASSERT_EQ(1, addrs.count(addr));
ASSERT_EQ(1, addrs.count(addr2));

View File

@ -84,7 +84,7 @@ bool CBasicKeyStore::HaveWatchOnly() const
return (!setWatchOnly.empty());
}
bool CBasicKeyStore::AddSpendingKey(const libzcash::SproutSpendingKey &sk)
bool CBasicKeyStore::AddSproutSpendingKey(const libzcash::SproutSpendingKey &sk)
{
LOCK(cs_SpendingKeyStore);
auto address = sk.address();

View File

@ -49,12 +49,12 @@ public:
virtual bool HaveWatchOnly() const =0;
//! Add a spending key to the store.
virtual bool AddSpendingKey(const libzcash::SproutSpendingKey &sk) =0;
virtual bool AddSproutSpendingKey(const libzcash::SproutSpendingKey &sk) =0;
//! Check whether a spending key corresponding to a given payment address is present in the store.
virtual bool HaveSpendingKey(const libzcash::SproutPaymentAddress &address) const =0;
virtual bool GetSpendingKey(const libzcash::SproutPaymentAddress &address, libzcash::SproutSpendingKey& skOut) const =0;
virtual void GetPaymentAddresses(std::set<libzcash::SproutPaymentAddress> &setAddress) const =0;
virtual bool HaveSproutSpendingKey(const libzcash::SproutPaymentAddress &address) const =0;
virtual bool GetSproutSpendingKey(const libzcash::SproutPaymentAddress &address, libzcash::SproutSpendingKey& skOut) const =0;
virtual void GetSproutPaymentAddresses(std::set<libzcash::SproutPaymentAddress> &setAddress) const =0;
//! Add a Sapling spending key to the store.
virtual bool AddSaplingSpendingKey(
@ -166,8 +166,8 @@ public:
virtual bool HaveWatchOnly(const CScript &dest) const;
virtual bool HaveWatchOnly() const;
bool AddSpendingKey(const libzcash::SproutSpendingKey &sk);
bool HaveSpendingKey(const libzcash::SproutPaymentAddress &address) const
bool AddSproutSpendingKey(const libzcash::SproutSpendingKey &sk);
bool HaveSproutSpendingKey(const libzcash::SproutPaymentAddress &address) const
{
bool result;
{
@ -176,7 +176,7 @@ public:
}
return result;
}
bool GetSpendingKey(const libzcash::SproutPaymentAddress &address, libzcash::SproutSpendingKey &skOut) const
bool GetSproutSpendingKey(const libzcash::SproutPaymentAddress &address, libzcash::SproutSpendingKey &skOut) const
{
{
LOCK(cs_SpendingKeyStore);
@ -202,7 +202,7 @@ public:
}
return false;
}
void GetPaymentAddresses(std::set<libzcash::SproutPaymentAddress> &setAddress) const
void GetSproutPaymentAddresses(std::set<libzcash::SproutPaymentAddress> &setAddress) const
{
setAddress.clear();
{

View File

@ -218,7 +218,7 @@ public:
obj.push_back(Pair("transmissionkey", zaddr.pk_enc.GetHex()));
#ifdef ENABLE_WALLET
if (pwalletMain) {
obj.push_back(Pair("ismine", pwalletMain->HaveSpendingKey(zaddr)));
obj.push_back(Pair("ismine", pwalletMain->HaveSproutSpendingKey(zaddr)));
}
#endif
return obj;

View File

@ -343,7 +343,7 @@ BOOST_AUTO_TEST_CASE(rpc_wallet_z_validateaddress)
// Wallet should be empty
std::set<libzcash::SproutPaymentAddress> addrs;
pwalletMain->GetPaymentAddresses(addrs);
pwalletMain->GetSproutPaymentAddresses(addrs);
BOOST_CHECK(addrs.size()==0);
// This address is not valid, it belongs to another network
@ -400,7 +400,7 @@ BOOST_AUTO_TEST_CASE(rpc_wallet_z_exportwallet)
// wallet should be empty
std::set<libzcash::SproutPaymentAddress> addrs;
pwalletMain->GetPaymentAddresses(addrs);
pwalletMain->GetSproutPaymentAddresses(addrs);
BOOST_CHECK(addrs.size()==0);
// wallet should have one key
@ -408,7 +408,7 @@ BOOST_AUTO_TEST_CASE(rpc_wallet_z_exportwallet)
BOOST_CHECK(IsValidPaymentAddress(address));
BOOST_ASSERT(boost::get<libzcash::SproutPaymentAddress>(&address) != nullptr);
auto addr = boost::get<libzcash::SproutPaymentAddress>(address);
pwalletMain->GetPaymentAddresses(addrs);
pwalletMain->GetSproutPaymentAddresses(addrs);
BOOST_CHECK(addrs.size()==1);
// Set up paths
@ -433,7 +433,7 @@ BOOST_AUTO_TEST_CASE(rpc_wallet_z_exportwallet)
libzcash::SproutSpendingKey key;
BOOST_CHECK(pwalletMain->GetSpendingKey(addr, key));
BOOST_CHECK(pwalletMain->GetSproutSpendingKey(addr, key));
std::string s1 = EncodePaymentAddress(addr);
std::string s2 = EncodeSpendingKey(key);
@ -507,14 +507,14 @@ BOOST_AUTO_TEST_CASE(rpc_wallet_z_importwallet)
// wallet should currently be empty
std::set<libzcash::SproutPaymentAddress> addrs;
pwalletMain->GetPaymentAddresses(addrs);
pwalletMain->GetSproutPaymentAddresses(addrs);
BOOST_CHECK(addrs.size()==0);
// import test data from file into wallet
BOOST_CHECK_NO_THROW(CallRPC(string("z_importwallet ") + path));
// wallet should now have one zkey
pwalletMain->GetPaymentAddresses(addrs);
pwalletMain->GetSproutPaymentAddresses(addrs);
BOOST_CHECK(addrs.size()==1);
// check that we have the spending key for the address
@ -522,11 +522,11 @@ BOOST_AUTO_TEST_CASE(rpc_wallet_z_importwallet)
BOOST_CHECK(IsValidPaymentAddress(address));
BOOST_ASSERT(boost::get<libzcash::SproutPaymentAddress>(&address) != nullptr);
auto addr = boost::get<libzcash::SproutPaymentAddress>(address);
BOOST_CHECK(pwalletMain->HaveSpendingKey(addr));
BOOST_CHECK(pwalletMain->HaveSproutSpendingKey(addr));
// Verify the spending key is the same as the test data
libzcash::SproutSpendingKey k;
BOOST_CHECK(pwalletMain->GetSpendingKey(addr, k));
BOOST_CHECK(pwalletMain->GetSproutSpendingKey(addr, k));
BOOST_CHECK_EQUAL(testKey, EncodeSpendingKey(k));
}
@ -559,7 +559,7 @@ BOOST_AUTO_TEST_CASE(rpc_wallet_z_importexport)
// wallet should currently be empty
std::set<libzcash::SproutPaymentAddress> addrs;
pwalletMain->GetPaymentAddresses(addrs);
pwalletMain->GetSproutPaymentAddresses(addrs);
BOOST_CHECK(addrs.size()==0);
std::set<libzcash::SaplingPaymentAddress> saplingAddrs;
pwalletMain->GetSaplingPaymentAddresses(saplingAddrs);
@ -605,7 +605,7 @@ BOOST_AUTO_TEST_CASE(rpc_wallet_z_importexport)
// Verify number of addresses stored in wallet is n1+n2
int numAddrs = myaddrs.size();
BOOST_CHECK(numAddrs == (2 * n1) + n2);
pwalletMain->GetPaymentAddresses(addrs);
pwalletMain->GetSproutPaymentAddresses(addrs);
pwalletMain->GetSaplingPaymentAddresses(saplingAddrs);
BOOST_CHECK(addrs.size() + saplingAddrs.size() == numAddrs);
@ -631,7 +631,7 @@ BOOST_AUTO_TEST_CASE(rpc_wallet_z_importexport)
BOOST_CHECK(IsValidPaymentAddress(address));
BOOST_ASSERT(boost::get<libzcash::SproutPaymentAddress>(&address) != nullptr);
auto newAddr = boost::get<libzcash::SproutPaymentAddress>(address);
BOOST_CHECK(pwalletMain->HaveSpendingKey(newAddr));
BOOST_CHECK(pwalletMain->HaveSproutSpendingKey(newAddr));
// Check if too many args
BOOST_CHECK_THROW(CallRPC("z_getnewaddress toomanyargs"), runtime_error);
@ -1258,7 +1258,7 @@ BOOST_AUTO_TEST_CASE(rpc_wallet_encrypted_wallet_zkeys)
// wallet should currently be empty
std::set<libzcash::SproutPaymentAddress> addrs;
pwalletMain->GetPaymentAddresses(addrs);
pwalletMain->GetSproutPaymentAddresses(addrs);
BOOST_CHECK(addrs.size()==0);
// create keys

View File

@ -89,7 +89,7 @@ AsyncRPCOperation_sendmany::AsyncRPCOperation_sendmany(
// We don't need to lock on the wallet as spending key related methods are thread-safe
SproutSpendingKey key;
if (!pwalletMain->GetSpendingKey(addr, key)) {
if (!pwalletMain->GetSproutSpendingKey(addr, key)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid from address, no spending key found for zaddr");
}

View File

@ -330,12 +330,12 @@ bool CCryptoKeyStore::GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) co
return false;
}
bool CCryptoKeyStore::AddSpendingKey(const libzcash::SproutSpendingKey &sk)
bool CCryptoKeyStore::AddSproutSpendingKey(const libzcash::SproutSpendingKey &sk)
{
{
LOCK(cs_SpendingKeyStore);
if (!IsCrypted())
return CBasicKeyStore::AddSpendingKey(sk);
return CBasicKeyStore::AddSproutSpendingKey(sk);
if (IsLocked())
return false;
@ -348,7 +348,7 @@ bool CCryptoKeyStore::AddSpendingKey(const libzcash::SproutSpendingKey &sk)
if (!EncryptSecret(vMasterKey, vchSecret, address.GetHash(), vchCryptedSecret))
return false;
if (!AddCryptedSpendingKey(address, sk.receiving_key(), vchCryptedSecret))
if (!AddCryptedSproutSpendingKey(address, sk.receiving_key(), vchCryptedSecret))
return false;
}
return true;
@ -384,9 +384,10 @@ bool CCryptoKeyStore::AddSaplingSpendingKey(
return true;
}
bool CCryptoKeyStore::AddCryptedSpendingKey(const libzcash::SproutPaymentAddress &address,
const libzcash::ReceivingKey &rk,
const std::vector<unsigned char> &vchCryptedSecret)
bool CCryptoKeyStore::AddCryptedSproutSpendingKey(
const libzcash::SproutPaymentAddress &address,
const libzcash::ReceivingKey &rk,
const std::vector<unsigned char> &vchCryptedSecret)
{
{
LOCK(cs_SpendingKeyStore);
@ -420,12 +421,12 @@ bool CCryptoKeyStore::AddCryptedSaplingSpendingKey(
return true;
}
bool CCryptoKeyStore::GetSpendingKey(const libzcash::SproutPaymentAddress &address, libzcash::SproutSpendingKey &skOut) const
bool CCryptoKeyStore::GetSproutSpendingKey(const libzcash::SproutPaymentAddress &address, libzcash::SproutSpendingKey &skOut) const
{
{
LOCK(cs_SpendingKeyStore);
if (!IsCrypted())
return CBasicKeyStore::GetSpendingKey(address, skOut);
return CBasicKeyStore::GetSproutSpendingKey(address, skOut);
CryptedSproutSpendingKeyMap::const_iterator mi = mapCryptedSproutSpendingKeys.find(address);
if (mi != mapCryptedSproutSpendingKeys.end())
@ -487,7 +488,7 @@ bool CCryptoKeyStore::EncryptKeys(CKeyingMaterial& vMasterKeyIn)
if (!EncryptSecret(vMasterKeyIn, vchSecret, address.GetHash(), vchCryptedSecret)) {
return false;
}
if (!AddCryptedSpendingKey(address, sk.receiving_key(), vchCryptedSecret)) {
if (!AddCryptedSproutSpendingKey(address, sk.receiving_key(), vchCryptedSecret)) {
return false;
}
}

View File

@ -201,26 +201,27 @@ public:
mi++;
}
}
virtual bool AddCryptedSpendingKey(const libzcash::SproutPaymentAddress &address,
const libzcash::ReceivingKey &rk,
const std::vector<unsigned char> &vchCryptedSecret);
bool AddSpendingKey(const libzcash::SproutSpendingKey &sk);
bool HaveSpendingKey(const libzcash::SproutPaymentAddress &address) const
virtual bool AddCryptedSproutSpendingKey(
const libzcash::SproutPaymentAddress &address,
const libzcash::ReceivingKey &rk,
const std::vector<unsigned char> &vchCryptedSecret);
bool AddSproutSpendingKey(const libzcash::SproutSpendingKey &sk);
bool HaveSproutSpendingKey(const libzcash::SproutPaymentAddress &address) const
{
{
LOCK(cs_SpendingKeyStore);
if (!IsCrypted())
return CBasicKeyStore::HaveSpendingKey(address);
return CBasicKeyStore::HaveSproutSpendingKey(address);
return mapCryptedSproutSpendingKeys.count(address) > 0;
}
return false;
}
bool GetSpendingKey(const libzcash::SproutPaymentAddress &address, libzcash::SproutSpendingKey &skOut) const;
void GetPaymentAddresses(std::set<libzcash::SproutPaymentAddress> &setAddress) const
bool GetSproutSpendingKey(const libzcash::SproutPaymentAddress &address, libzcash::SproutSpendingKey &skOut) const;
void GetSproutPaymentAddresses(std::set<libzcash::SproutPaymentAddress> &setAddress) const
{
if (!IsCrypted())
{
CBasicKeyStore::GetPaymentAddresses(setAddress);
CBasicKeyStore::GetSproutPaymentAddresses(setAddress);
return;
}
setAddress.clear();

View File

@ -166,7 +166,7 @@ TEST(wallet_tests, find_unspent_notes) {
SelectParams(CBaseChainParams::TESTNET);
CWallet wallet;
auto sk = libzcash::SproutSpendingKey::random();
wallet.AddSpendingKey(sk);
wallet.AddSproutSpendingKey(sk);
auto wtx = GetValidReceive(sk, 10, true);
auto note = GetNote(sk, wtx, 0, 1);
@ -371,7 +371,7 @@ TEST(wallet_tests, GetNoteNullifier) {
hSig, 1);
EXPECT_NE(nullifier, ret);
wallet.AddSpendingKey(sk);
wallet.AddSproutSpendingKey(sk);
ret = wallet.GetNoteNullifier(
wtx.vjoinsplit[0],
@ -386,7 +386,7 @@ TEST(wallet_tests, FindMyNotes) {
auto sk = libzcash::SproutSpendingKey::random();
auto sk2 = libzcash::SproutSpendingKey::random();
wallet.AddSpendingKey(sk2);
wallet.AddSproutSpendingKey(sk2);
auto wtx = GetValidReceive(sk, 10, true);
auto note = GetNote(sk, wtx, 0, 1);
@ -395,7 +395,7 @@ TEST(wallet_tests, FindMyNotes) {
auto noteMap = wallet.FindMyNotes(wtx);
EXPECT_EQ(0, noteMap.size());
wallet.AddSpendingKey(sk);
wallet.AddSproutSpendingKey(sk);
noteMap = wallet.FindMyNotes(wtx);
EXPECT_EQ(2, noteMap.size());
@ -412,7 +412,7 @@ TEST(wallet_tests, FindMyNotesInEncryptedWallet) {
CKeyingMaterial vMasterKey (r.begin(), r.end());
auto sk = libzcash::SproutSpendingKey::random();
wallet.AddSpendingKey(sk);
wallet.AddSproutSpendingKey(sk);
ASSERT_TRUE(wallet.EncryptKeys(vMasterKey));
@ -440,7 +440,7 @@ TEST(wallet_tests, get_conflicted_notes) {
CWallet wallet;
auto sk = libzcash::SproutSpendingKey::random();
wallet.AddSpendingKey(sk);
wallet.AddSproutSpendingKey(sk);
auto wtx = GetValidReceive(sk, 10, true);
auto note = GetNote(sk, wtx, 0, 1);
@ -471,7 +471,7 @@ TEST(wallet_tests, nullifier_is_spent) {
CWallet wallet;
auto sk = libzcash::SproutSpendingKey::random();
wallet.AddSpendingKey(sk);
wallet.AddSproutSpendingKey(sk);
auto wtx = GetValidReceive(sk, 10, true);
auto note = GetNote(sk, wtx, 0, 1);
@ -511,7 +511,7 @@ TEST(wallet_tests, navigate_from_nullifier_to_note) {
CWallet wallet;
auto sk = libzcash::SproutSpendingKey::random();
wallet.AddSpendingKey(sk);
wallet.AddSproutSpendingKey(sk);
auto wtx = GetValidReceive(sk, 10, true);
auto note = GetNote(sk, wtx, 0, 1);
@ -537,7 +537,7 @@ TEST(wallet_tests, spent_note_is_from_me) {
CWallet wallet;
auto sk = libzcash::SproutSpendingKey::random();
wallet.AddSpendingKey(sk);
wallet.AddSproutSpendingKey(sk);
auto wtx = GetValidReceive(sk, 10, true);
auto note = GetNote(sk, wtx, 0, 1);
@ -565,7 +565,7 @@ TEST(wallet_tests, cached_witnesses_empty_chain) {
TestWallet wallet;
auto sk = libzcash::SproutSpendingKey::random();
wallet.AddSpendingKey(sk);
wallet.AddSproutSpendingKey(sk);
auto wtx = GetValidReceive(sk, 10, true, 4);
auto note = GetNote(sk, wtx, 0, 0);
@ -628,7 +628,7 @@ TEST(wallet_tests, cached_witnesses_chain_tip) {
SaplingMerkleTree saplingTree;
auto sk = libzcash::SproutSpendingKey::random();
wallet.AddSpendingKey(sk);
wallet.AddSproutSpendingKey(sk);
{
// First block (case tested in _empty_chain)
@ -728,7 +728,7 @@ TEST(wallet_tests, CachedWitnessesDecrementFirst) {
SaplingMerkleTree saplingTree;
auto sk = libzcash::SproutSpendingKey::random();
wallet.AddSpendingKey(sk);
wallet.AddSproutSpendingKey(sk);
{
// First block (case tested in _empty_chain)
@ -818,7 +818,7 @@ TEST(wallet_tests, CachedWitnessesCleanIndex) {
std::vector<boost::optional<SaplingWitness>> saplingWitnesses;
auto sk = libzcash::SproutSpendingKey::random();
wallet.AddSpendingKey(sk);
wallet.AddSproutSpendingKey(sk);
// Generate a chain
size_t numBlocks = WITNESS_CACHE_SIZE + 10;
@ -893,7 +893,7 @@ TEST(wallet_tests, ClearNoteWitnessCache) {
TestWallet wallet;
auto sk = libzcash::SproutSpendingKey::random();
wallet.AddSpendingKey(sk);
wallet.AddSproutSpendingKey(sk);
auto wtx = GetValidReceive(sk, 10, true, 4);
auto hash = wtx.GetHash();
@ -953,7 +953,7 @@ TEST(wallet_tests, WriteWitnessCache) {
CBlockLocator loc;
auto sk = libzcash::SproutSpendingKey::random();
wallet.AddSpendingKey(sk);
wallet.AddSproutSpendingKey(sk);
auto wtx = GetValidReceive(sk, 10, true);
wallet.AddToWallet(wtx, true, NULL);
@ -1030,7 +1030,7 @@ TEST(wallet_tests, UpdateNullifierNoteMap) {
CKeyingMaterial vMasterKey (r.begin(), r.end());
auto sk = libzcash::SproutSpendingKey::random();
wallet.AddSpendingKey(sk);
wallet.AddSproutSpendingKey(sk);
ASSERT_TRUE(wallet.EncryptKeys(vMasterKey));
@ -1063,7 +1063,7 @@ TEST(wallet_tests, UpdatedNoteData) {
TestWallet wallet;
auto sk = libzcash::SproutSpendingKey::random();
wallet.AddSpendingKey(sk);
wallet.AddSproutSpendingKey(sk);
auto wtx = GetValidReceive(sk, 10, true);
auto note = GetNote(sk, wtx, 0, 0);
@ -1110,7 +1110,7 @@ TEST(wallet_tests, MarkAffectedTransactionsDirty) {
TestWallet wallet;
auto sk = libzcash::SproutSpendingKey::random();
wallet.AddSpendingKey(sk);
wallet.AddSproutSpendingKey(sk);
auto wtx = GetValidReceive(sk, 10, true);
auto hash = wtx.GetHash();
@ -1141,7 +1141,7 @@ TEST(wallet_tests, NoteLocking) {
TestWallet wallet;
auto sk = libzcash::SproutSpendingKey::random();
wallet.AddSpendingKey(sk);
wallet.AddSproutSpendingKey(sk);
auto wtx = GetValidReceive(sk, 10, true);
auto wtx2 = GetValidReceive(sk, 10, true);

View File

@ -63,18 +63,18 @@ TEST(wallet_zkeys_tests, store_and_load_zkeys) {
// wallet should be empty
std::set<libzcash::SproutPaymentAddress> addrs;
wallet.GetPaymentAddresses(addrs);
wallet.GetSproutPaymentAddresses(addrs);
ASSERT_EQ(0, addrs.size());
// wallet should have one key
auto address = wallet.GenerateNewZKey();
ASSERT_NE(boost::get<libzcash::SproutPaymentAddress>(&address), nullptr);
auto addr = boost::get<libzcash::SproutPaymentAddress>(address);
wallet.GetPaymentAddresses(addrs);
wallet.GetSproutPaymentAddresses(addrs);
ASSERT_EQ(1, addrs.size());
// verify wallet has spending key for the address
ASSERT_TRUE(wallet.HaveSpendingKey(addr));
ASSERT_TRUE(wallet.HaveSproutSpendingKey(addr));
// manually add new spending key to wallet
auto sk = libzcash::SproutSpendingKey::random();
@ -82,15 +82,15 @@ TEST(wallet_zkeys_tests, store_and_load_zkeys) {
// verify wallet did add it
addr = sk.address();
ASSERT_TRUE(wallet.HaveSpendingKey(addr));
ASSERT_TRUE(wallet.HaveSproutSpendingKey(addr));
// verify spending key stored correctly
libzcash::SproutSpendingKey keyOut;
wallet.GetSpendingKey(addr, keyOut);
wallet.GetSproutSpendingKey(addr, keyOut);
ASSERT_EQ(sk, keyOut);
// verify there are two keys
wallet.GetPaymentAddresses(addrs);
wallet.GetSproutPaymentAddresses(addrs);
ASSERT_EQ(2, addrs.size());
ASSERT_EQ(1, addrs.count(addr));
@ -122,7 +122,7 @@ TEST(wallet_zkeys_tests, StoreAndLoadViewingKeys) {
// wallet should be empty
std::set<libzcash::SproutPaymentAddress> addrs;
wallet.GetPaymentAddresses(addrs);
wallet.GetSproutPaymentAddresses(addrs);
ASSERT_EQ(0, addrs.size());
// manually add new viewing key to wallet
@ -134,7 +134,7 @@ TEST(wallet_zkeys_tests, StoreAndLoadViewingKeys) {
auto addr = sk.address();
ASSERT_TRUE(wallet.HaveSproutViewingKey(addr));
// and that we don't have the corresponding spending key
ASSERT_FALSE(wallet.HaveSpendingKey(addr));
ASSERT_FALSE(wallet.HaveSproutSpendingKey(addr));
// verify viewing key stored correctly
libzcash::SproutViewingKey vkOut;
@ -148,7 +148,7 @@ TEST(wallet_zkeys_tests, StoreAndLoadViewingKeys) {
// verify wallet did add it
auto addr2 = sk2.address();
ASSERT_TRUE(wallet.HaveSproutViewingKey(addr2));
ASSERT_FALSE(wallet.HaveSpendingKey(addr2));
ASSERT_FALSE(wallet.HaveSproutSpendingKey(addr2));
// Remove the first viewing key
ASSERT_TRUE(wallet.RemoveSproutViewingKey(vk));
@ -178,14 +178,14 @@ TEST(wallet_zkeys_tests, write_zkey_direct_to_db) {
// wallet should be empty
std::set<libzcash::SproutPaymentAddress> addrs;
wallet.GetPaymentAddresses(addrs);
wallet.GetSproutPaymentAddresses(addrs);
ASSERT_EQ(0, addrs.size());
// Add random key to the wallet
auto paymentAddress = wallet.GenerateNewZKey();
// wallet should have one key
wallet.GetPaymentAddresses(addrs);
wallet.GetSproutPaymentAddresses(addrs);
ASSERT_EQ(1, addrs.size());
// create random key and add it to database directly, bypassing wallet
@ -197,10 +197,10 @@ TEST(wallet_zkeys_tests, write_zkey_direct_to_db) {
db.WriteZKey(addr, sk, meta);
// wallet should not be aware of key
ASSERT_FALSE(wallet.HaveSpendingKey(addr));
ASSERT_FALSE(wallet.HaveSproutSpendingKey(addr));
// wallet sees one key
wallet.GetPaymentAddresses(addrs);
wallet.GetSproutPaymentAddresses(addrs);
ASSERT_EQ(1, addrs.size());
// wallet should have default metadata for addr with null createtime
@ -212,15 +212,15 @@ TEST(wallet_zkeys_tests, write_zkey_direct_to_db) {
ASSERT_EQ(DB_LOAD_OK, wallet.LoadWallet(fFirstRun));
// wallet can now see the spending key
ASSERT_TRUE(wallet.HaveSpendingKey(addr));
ASSERT_TRUE(wallet.HaveSproutSpendingKey(addr));
// check key is the same
libzcash::SproutSpendingKey keyOut;
wallet.GetSpendingKey(addr, keyOut);
wallet.GetSproutSpendingKey(addr, keyOut);
ASSERT_EQ(sk, keyOut);
// wallet should have two keys
wallet.GetPaymentAddresses(addrs);
wallet.GetSproutPaymentAddresses(addrs);
ASSERT_EQ(2, addrs.size());
// check metadata is now the same
@ -295,7 +295,7 @@ TEST(wallet_zkeys_tests, write_cryptedzkey_direct_to_db) {
// wallet should be empty
std::set<libzcash::SproutPaymentAddress> addrs;
wallet.GetPaymentAddresses(addrs);
wallet.GetSproutPaymentAddresses(addrs);
ASSERT_EQ(0, addrs.size());
// Add random key to the wallet
@ -304,7 +304,7 @@ TEST(wallet_zkeys_tests, write_cryptedzkey_direct_to_db) {
auto paymentAddress = boost::get<libzcash::SproutPaymentAddress>(address);
// wallet should have one key
wallet.GetPaymentAddresses(addrs);
wallet.GetSproutPaymentAddresses(addrs);
ASSERT_EQ(1, addrs.size());
// encrypt wallet
@ -330,7 +330,7 @@ TEST(wallet_zkeys_tests, write_cryptedzkey_direct_to_db) {
ASSERT_TRUE(&wallet != &wallet2);
// wallet should have two keys
wallet2.GetPaymentAddresses(addrs);
wallet2.GetSproutPaymentAddresses(addrs);
ASSERT_EQ(2, addrs.size());
// check we have entries for our payment addresses
@ -339,16 +339,16 @@ TEST(wallet_zkeys_tests, write_cryptedzkey_direct_to_db) {
// spending key is crypted, so we can't extract valid payment address
libzcash::SproutSpendingKey keyOut;
wallet2.GetSpendingKey(paymentAddress, keyOut);
wallet2.GetSproutSpendingKey(paymentAddress, keyOut);
ASSERT_FALSE(paymentAddress == keyOut.address());
// unlock wallet to get spending keys and verify payment addresses
wallet2.Unlock(strWalletPass);
wallet2.GetSpendingKey(paymentAddress, keyOut);
wallet2.GetSproutSpendingKey(paymentAddress, keyOut);
ASSERT_EQ(paymentAddress, keyOut.address());
wallet2.GetSpendingKey(paymentAddress2, keyOut);
wallet2.GetSproutSpendingKey(paymentAddress2, keyOut);
ASSERT_EQ(paymentAddress2, keyOut.address());
}

View File

@ -302,7 +302,7 @@ UniValue importwallet_impl(const UniValue& params, bool fHelp, bool fImportZKeys
assert(boost::get<libzcash::SproutSpendingKey>(&spendingkey) != nullptr);
auto key = boost::get<libzcash::SproutSpendingKey>(spendingkey);
auto addr = key.address();
if (pwalletMain->HaveSpendingKey(addr)) {
if (pwalletMain->HaveSproutSpendingKey(addr)) {
LogPrint("zrpc", "Skipping import of zaddr %s (key already present)\n", EncodePaymentAddress(addr));
continue;
}
@ -530,13 +530,13 @@ UniValue dumpwallet_impl(const UniValue& params, bool fHelp, bool fDumpZKeys)
if (fDumpZKeys) {
std::set<libzcash::SproutPaymentAddress> addresses;
pwalletMain->GetPaymentAddresses(addresses);
pwalletMain->GetSproutPaymentAddresses(addresses);
file << "\n";
file << "# Zkeys\n";
file << "\n";
for (auto addr : addresses ) {
libzcash::SproutSpendingKey key;
if (pwalletMain->GetSpendingKey(addr, key)) {
if (pwalletMain->GetSproutSpendingKey(addr, key)) {
std::string strTime = EncodeDumpTime(pwalletMain->mapZKeyMetadata[addr].nCreateTime);
file << strprintf("%s %s # zaddr=%s\n", EncodeSpendingKey(key), strTime, EncodePaymentAddress(addr));
}
@ -560,7 +560,7 @@ public:
bool operator()(const libzcash::SproutSpendingKey &sk) const {
auto addr = sk.address();
// Don't throw error in case a key is already there
if (m_wallet->HaveSpendingKey(addr)) {
if (m_wallet->HaveSproutSpendingKey(addr)) {
return true;
} else {
m_wallet->MarkDirty();
@ -758,7 +758,7 @@ UniValue z_importviewingkey(const UniValue& params, bool fHelp)
auto addr = vkey.address();
{
if (pwalletMain->HaveSpendingKey(addr)) {
if (pwalletMain->HaveSproutSpendingKey(addr)) {
throw JSONRPCError(RPC_WALLET_ERROR, "The wallet already contains the private key for this viewing key");
}
@ -794,7 +794,7 @@ public:
libzcash::SpendingKey operator()(const libzcash::SproutPaymentAddress &zaddr) const
{
libzcash::SproutSpendingKey k;
if (!pwalletMain->GetSpendingKey(zaddr, k)) {
if (!pwalletMain->GetSproutSpendingKey(zaddr, k)) {
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet does not hold private zkey for this zaddr");
}
return k;
@ -891,7 +891,7 @@ UniValue z_exportviewingkey(const UniValue& params, bool fHelp)
libzcash::SproutViewingKey vk;
if (!pwalletMain->GetSproutViewingKey(addr, vk)) {
libzcash::SproutSpendingKey k;
if (!pwalletMain->GetSpendingKey(addr, k)) {
if (!pwalletMain->GetSproutSpendingKey(addr, k)) {
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet does not hold private key or viewing key for this zaddr");
}
vk = k.viewing_key();

View File

@ -2531,7 +2531,7 @@ UniValue z_listunspent(const UniValue& params, bool fHelp)
// TODO: Add Sapling support. For now, ensure we can freely convert.
assert(boost::get<libzcash::SproutPaymentAddress>(&zaddr) != nullptr);
libzcash::SproutPaymentAddress addr = boost::get<libzcash::SproutPaymentAddress>(zaddr);
if (!fIncludeWatchonly && !pwalletMain->HaveSpendingKey(addr)) {
if (!fIncludeWatchonly && !pwalletMain->HaveSproutSpendingKey(addr)) {
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, spending key for address does not belong to wallet: ") + address);
}
zaddrs.insert(addr);
@ -2549,7 +2549,7 @@ UniValue z_listunspent(const UniValue& params, bool fHelp)
// User did not provide zaddrs, so use default i.e. all addresses
// TODO: Add Sapling support
std::set<libzcash::SproutPaymentAddress> sproutzaddrs = {};
pwalletMain->GetPaymentAddresses(sproutzaddrs);
pwalletMain->GetSproutPaymentAddresses(sproutzaddrs);
zaddrs.insert(sproutzaddrs.begin(), sproutzaddrs.end());
}
@ -2565,7 +2565,7 @@ UniValue z_listunspent(const UniValue& params, bool fHelp)
obj.push_back(Pair("jsindex", (int)entry.jsop.js ));
obj.push_back(Pair("jsoutindex", (int)entry.jsop.n));
obj.push_back(Pair("confirmations", entry.nHeight));
obj.push_back(Pair("spendable", pwalletMain->HaveSpendingKey(boost::get<libzcash::SproutPaymentAddress>(entry.address))));
obj.push_back(Pair("spendable", pwalletMain->HaveSproutSpendingKey(boost::get<libzcash::SproutPaymentAddress>(entry.address))));
obj.push_back(Pair("address", EncodePaymentAddress(entry.address)));
obj.push_back(Pair("amount", ValueFromAmount(CAmount(entry.plaintext.value()))));
std::string data(entry.plaintext.memo().begin(), entry.plaintext.memo().end());
@ -3171,9 +3171,9 @@ UniValue z_listaddresses(const UniValue& params, bool fHelp)
UniValue ret(UniValue::VARR);
{
std::set<libzcash::SproutPaymentAddress> addresses;
pwalletMain->GetPaymentAddresses(addresses);
pwalletMain->GetSproutPaymentAddresses(addresses);
for (auto addr : addresses) {
if (fIncludeWatchonly || pwalletMain->HaveSpendingKey(addr)) {
if (fIncludeWatchonly || pwalletMain->HaveSproutSpendingKey(addr)) {
ret.push_back(EncodePaymentAddress(addr));
}
}
@ -3296,7 +3296,7 @@ UniValue z_listreceivedbyaddress(const UniValue& params, bool fHelp)
assert(boost::get<libzcash::SproutPaymentAddress>(&zaddr) != nullptr);
auto sproutzaddr = boost::get<libzcash::SproutPaymentAddress>(zaddr);
if (!(pwalletMain->HaveSpendingKey(sproutzaddr) || pwalletMain->HaveSproutViewingKey(sproutzaddr))) {
if (!(pwalletMain->HaveSproutSpendingKey(sproutzaddr) || pwalletMain->HaveSproutViewingKey(sproutzaddr))) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "From address does not belong to this node, zaddr spending key or viewing key not found.");
}
@ -3368,7 +3368,7 @@ UniValue z_getbalance(const UniValue& params, bool fHelp)
// TODO: Add Sapling support. For now, ensure we can freely convert.
assert(boost::get<libzcash::SproutPaymentAddress>(&res) != nullptr);
auto zaddr = boost::get<libzcash::SproutPaymentAddress>(res);
if (!(pwalletMain->HaveSpendingKey(zaddr) || pwalletMain->HaveSproutViewingKey(zaddr))) {
if (!(pwalletMain->HaveSproutSpendingKey(zaddr) || pwalletMain->HaveSproutViewingKey(zaddr))) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "From address does not belong to this node, zaddr spending key or viewing key not found.");
}
}
@ -3610,7 +3610,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp)
// Check that we have the spending key
if (!fromTaddr) {
if (!pwalletMain->HaveSpendingKey(zaddr)) {
if (!pwalletMain->HaveSproutSpendingKey(zaddr)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "From address does not belong to this node, zaddr spending key not found.");
}
}
@ -4259,7 +4259,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp)
// TODO: Add Sapling support
auto zaddr = boost::get<SproutPaymentAddress>(entry.address);
SproutSpendingKey zkey;
pwalletMain->GetSpendingKey(zaddr, zkey);
pwalletMain->GetSproutSpendingKey(zaddr, zkey);
noteInputs.emplace_back(entry.jsop, entry.plaintext.note(zaddr), nValue, zkey);
mergedNoteValue += nValue;
}

View File

@ -88,7 +88,7 @@ libzcash::PaymentAddress CWallet::GenerateNewZKey()
auto addr = k.address();
// Check for collision, even though it is unlikely to ever occur
if (CCryptoKeyStore::HaveSpendingKey(addr))
if (CCryptoKeyStore::HaveSproutSpendingKey(addr))
throw std::runtime_error("CWallet::GenerateNewZKey(): Collision detected");
// Create new metadata
@ -152,7 +152,7 @@ bool CWallet::AddZKey(const libzcash::SproutSpendingKey &key)
AssertLockHeld(cs_wallet); // mapZKeyMetadata
auto addr = key.address();
if (!CCryptoKeyStore::AddSpendingKey(key))
if (!CCryptoKeyStore::AddSproutSpendingKey(key))
return false;
// check if we need to remove from viewing keys
@ -241,11 +241,12 @@ bool CWallet::AddCryptedKey(const CPubKey &vchPubKey,
}
bool CWallet::AddCryptedSpendingKey(const libzcash::SproutPaymentAddress &address,
const libzcash::ReceivingKey &rk,
const std::vector<unsigned char> &vchCryptedSecret)
bool CWallet::AddCryptedSproutSpendingKey(
const libzcash::SproutPaymentAddress &address,
const libzcash::ReceivingKey &rk,
const std::vector<unsigned char> &vchCryptedSecret)
{
if (!CCryptoKeyStore::AddCryptedSpendingKey(address, rk, vchCryptedSecret))
if (!CCryptoKeyStore::AddCryptedSproutSpendingKey(address, rk, vchCryptedSecret))
return false;
if (!fFileBacked)
return true;
@ -304,12 +305,12 @@ bool CWallet::LoadCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigne
bool CWallet::LoadCryptedZKey(const libzcash::SproutPaymentAddress &addr, const libzcash::ReceivingKey &rk, const std::vector<unsigned char> &vchCryptedSecret)
{
return CCryptoKeyStore::AddCryptedSpendingKey(addr, rk, vchCryptedSecret);
return CCryptoKeyStore::AddCryptedSproutSpendingKey(addr, rk, vchCryptedSecret);
}
bool CWallet::LoadZKey(const libzcash::SproutSpendingKey &key)
{
return CCryptoKeyStore::AddSpendingKey(key);
return CCryptoKeyStore::AddSproutSpendingKey(key);
}
bool CWallet::AddSproutViewingKey(const libzcash::SproutViewingKey &vk)
@ -1420,7 +1421,7 @@ boost::optional<uint256> CWallet::GetNoteNullifier(const JSDescription& jsdesc,
// - We have them (this isn't a viewing key)
// - The wallet is unlocked
libzcash::SproutSpendingKey key;
if (GetSpendingKey(address, key)) {
if (GetSproutSpendingKey(address, key)) {
ret = note.nullifier(key);
}
return ret;
@ -3951,7 +3952,7 @@ void CWallet::GetFilteredNotes(
}
// skip notes which cannot be spent
if (ignoreUnspendable && !HaveSpendingKey(pa)) {
if (ignoreUnspendable && !HaveSproutSpendingKey(pa)) {
continue;
}
@ -4032,7 +4033,7 @@ void CWallet::GetUnspentFilteredNotes(
}
// skip notes where the spending key is not available
if (requireSpendingKey && !HaveSpendingKey(pa)) {
if (requireSpendingKey && !HaveSproutSpendingKey(pa)) {
continue;
}

View File

@ -992,7 +992,10 @@ public:
//! Adds an encrypted spending key to the store, without saving it to disk (used by LoadWallet)
bool LoadCryptedZKey(const libzcash::SproutPaymentAddress &addr, const libzcash::ReceivingKey &rk, const std::vector<unsigned char> &vchCryptedSecret);
//! Adds an encrypted spending key to the store, and saves it to disk (virtual method, declared in crypter.h)
bool AddCryptedSpendingKey(const libzcash::SproutPaymentAddress &address, const libzcash::ReceivingKey &rk, const std::vector<unsigned char> &vchCryptedSecret);
bool AddCryptedSproutSpendingKey(
const libzcash::SproutPaymentAddress &address,
const libzcash::ReceivingKey &rk,
const std::vector<unsigned char> &vchCryptedSecret);
//! Adds a Sprout viewing key to the store, and saves it to disk.
bool AddSproutViewingKey(const libzcash::SproutViewingKey &vk);

View File

@ -283,7 +283,7 @@ double benchmark_try_decrypt_notes(size_t nAddrs)
CWallet wallet;
for (int i = 0; i < nAddrs; i++) {
auto sk = libzcash::SproutSpendingKey::random();
wallet.AddSpendingKey(sk);
wallet.AddSproutSpendingKey(sk);
}
auto sk = libzcash::SproutSpendingKey::random();
@ -302,7 +302,7 @@ double benchmark_increment_note_witnesses(size_t nTxs)
SaplingMerkleTree saplingTree;
auto sk = libzcash::SproutSpendingKey::random();
wallet.AddSpendingKey(sk);
wallet.AddSproutSpendingKey(sk);
// First block
CBlock block1;