Browse Source

Rename AddZKey to include sprout

pull/4/head
Eirik Ogilvie-Wigley 6 years ago
parent
commit
a0783bb957
  1. 4
      src/wallet/gtest/test_wallet_zkeys.cpp
  2. 4
      src/wallet/rpcdump.cpp
  3. 6
      src/wallet/wallet.cpp
  4. 2
      src/wallet/wallet.h

4
src/wallet/gtest/test_wallet_zkeys.cpp

@ -63,7 +63,7 @@ TEST(wallet_zkeys_tests, store_and_load_sapling_zkeys) {
/**
* This test covers methods on CWallet
* GenerateNewZKey()
* AddZKey()
* AddSproutZKey()
* LoadZKey()
* LoadZKeyMetadata()
*/
@ -89,7 +89,7 @@ TEST(wallet_zkeys_tests, store_and_load_zkeys) {
// manually add new spending key to wallet
auto sk = libzcash::SproutSpendingKey::random();
ASSERT_TRUE(wallet.AddZKey(sk));
ASSERT_TRUE(wallet.AddSproutZKey(sk));
// verify wallet did add it
addr = sk.address();

4
src/wallet/rpcdump.cpp

@ -308,7 +308,7 @@ UniValue importwallet_impl(const UniValue& params, bool fHelp, bool fImportZKeys
}
int64_t nTime = DecodeDumpTime(vstr[1]);
LogPrint("zrpc", "Importing zaddr %s...\n", EncodePaymentAddress(addr));
if (!pwalletMain->AddZKey(key)) {
if (!pwalletMain->AddSproutZKey(key)) {
// Something went wrong
fGood = false;
continue;
@ -580,7 +580,7 @@ public:
} else {
m_wallet->MarkDirty();
if (!m_wallet-> AddZKey(sk)) {
if (!m_wallet-> AddSproutZKey(sk)) {
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding spending key to wallet");
}

6
src/wallet/wallet.cpp

@ -96,8 +96,8 @@ libzcash::PaymentAddress CWallet::GenerateNewZKey()
int64_t nCreationTime = GetTime();
mapSproutZKeyMetadata[addr] = CKeyMetadata(nCreationTime);
if (!AddZKey(k))
throw std::runtime_error("CWallet::GenerateNewZKey(): AddZKey failed");
if (!AddSproutZKey(k))
throw std::runtime_error("CWallet::GenerateNewZKey(): AddSproutZKey failed");
return addr;
}
@ -169,7 +169,7 @@ bool CWallet::AddSaplingZKey(
// Add spending key to keystore and persist to disk
bool CWallet::AddZKey(const libzcash::SproutSpendingKey &key)
bool CWallet::AddSproutZKey(const libzcash::SproutSpendingKey &key)
{
AssertLockHeld(cs_wallet); // mapSproutZKeyMetadata
auto addr = key.address();

2
src/wallet/wallet.h

@ -1031,7 +1031,7 @@ public:
//! Generates a new zaddr
libzcash::PaymentAddress GenerateNewZKey();
//! Adds spending key to the store, and saves it to disk
bool AddZKey(const libzcash::SproutSpendingKey &key);
bool AddSproutZKey(const libzcash::SproutSpendingKey &key);
//! Adds spending key to the store, without saving it to disk (used by LoadWallet)
bool LoadZKey(const libzcash::SproutSpendingKey &key);
//! Load spending key metadata (used by LoadWallet)

Loading…
Cancel
Save