GenerateNewSproutZKey can return a SproutPaymentAddress
This commit is contained in:
parent
92fc29a3f4
commit
d6ad8cef2c
|
@ -404,10 +404,8 @@ BOOST_AUTO_TEST_CASE(rpc_wallet_z_exportwallet)
|
|||
BOOST_CHECK(addrs.size()==0);
|
||||
|
||||
// wallet should have one key
|
||||
auto address = pwalletMain->GenerateNewSproutZKey();
|
||||
BOOST_CHECK(IsValidPaymentAddress(address));
|
||||
BOOST_ASSERT(boost::get<libzcash::SproutPaymentAddress>(&address) != nullptr);
|
||||
auto addr = boost::get<libzcash::SproutPaymentAddress>(address);
|
||||
auto addr = pwalletMain->GenerateNewSproutZKey();
|
||||
BOOST_CHECK(IsValidPaymentAddress(addr));
|
||||
pwalletMain->GetSproutPaymentAddresses(addrs);
|
||||
BOOST_CHECK(addrs.size()==1);
|
||||
|
||||
|
|
|
@ -121,9 +121,7 @@ TEST(wallet_zkeys_tests, store_and_load_zkeys) {
|
|||
ASSERT_EQ(0, addrs.size());
|
||||
|
||||
// wallet should have one key
|
||||
auto address = wallet.GenerateNewSproutZKey();
|
||||
ASSERT_NE(boost::get<libzcash::SproutPaymentAddress>(&address), nullptr);
|
||||
auto addr = boost::get<libzcash::SproutPaymentAddress>(address);
|
||||
auto addr = wallet.GenerateNewSproutZKey();
|
||||
wallet.GetSproutPaymentAddresses(addrs);
|
||||
ASSERT_EQ(1, addrs.size());
|
||||
|
||||
|
@ -353,9 +351,7 @@ TEST(wallet_zkeys_tests, write_cryptedzkey_direct_to_db) {
|
|||
ASSERT_EQ(0, addrs.size());
|
||||
|
||||
// Add random key to the wallet
|
||||
auto address = wallet.GenerateNewSproutZKey();
|
||||
ASSERT_NE(boost::get<libzcash::SproutPaymentAddress>(&address), nullptr);
|
||||
auto paymentAddress = boost::get<libzcash::SproutPaymentAddress>(address);
|
||||
auto paymentAddress = wallet.GenerateNewSproutZKey();
|
||||
|
||||
// wallet should have one key
|
||||
wallet.GetSproutPaymentAddresses(addrs);
|
||||
|
@ -372,9 +368,7 @@ TEST(wallet_zkeys_tests, write_cryptedzkey_direct_to_db) {
|
|||
|
||||
// unlock wallet and then add
|
||||
wallet.Unlock(strWalletPass);
|
||||
auto address2 = wallet.GenerateNewSproutZKey();
|
||||
ASSERT_NE(boost::get<libzcash::SproutPaymentAddress>(&address2), nullptr);
|
||||
auto paymentAddress2 = boost::get<libzcash::SproutPaymentAddress>(address2);
|
||||
auto paymentAddress2 = wallet.GenerateNewSproutZKey();
|
||||
|
||||
// Create a new wallet from the existing wallet path
|
||||
CWallet wallet2("wallet_crypted.dat");
|
||||
|
|
|
@ -82,10 +82,10 @@ const CWalletTx* CWallet::GetWalletTx(const uint256& hash) const
|
|||
}
|
||||
|
||||
// Generate a new spending key and return its public payment address
|
||||
libzcash::PaymentAddress CWallet::GenerateNewSproutZKey()
|
||||
libzcash::SproutPaymentAddress CWallet::GenerateNewSproutZKey()
|
||||
{
|
||||
AssertLockHeld(cs_wallet); // mapSproutZKeyMetadata
|
||||
// TODO: Add Sapling support
|
||||
|
||||
auto k = SproutSpendingKey::random();
|
||||
auto addr = k.address();
|
||||
|
||||
|
|
|
@ -1042,10 +1042,10 @@ public:
|
|||
void GetKeyBirthTimes(std::map<CKeyID, int64_t> &mapKeyBirth) const;
|
||||
|
||||
/**
|
||||
* ZKeys
|
||||
* Sprout ZKeys
|
||||
*/
|
||||
//! Generates a new zaddr
|
||||
libzcash::PaymentAddress GenerateNewSproutZKey();
|
||||
//! Generates a new Sprout zaddr
|
||||
libzcash::SproutPaymentAddress GenerateNewSproutZKey();
|
||||
//! Adds spending key to the store, and saves it to disk
|
||||
bool AddSproutZKey(const libzcash::SproutSpendingKey &key);
|
||||
//! Adds spending key to the store, without saving it to disk (used by LoadWallet)
|
||||
|
|
Loading…
Reference in New Issue