Add crypted keystore sapling add key

This commit is contained in:
Jay Graber
2018-07-03 14:51:27 -07:00
parent 8e91ebf76c
commit 2173767365
7 changed files with 87 additions and 2 deletions

View File

@@ -7,6 +7,29 @@
#include <boost/filesystem.hpp>
/**
* This test covers Sapling methods on CWallet
* GenerateNewSaplingZKey()
*/
TEST(wallet_zkeys_tests, store_and_load_sapling_zkeys) {
SelectParams(CBaseChainParams::MAIN);
CWallet wallet;
auto address = wallet.GenerateNewSaplingZKey();
// verify wallet has incoming viewing key for the address
ASSERT_TRUE(wallet.HaveSaplingIncomingViewingKey(address));
// manually add new spending key to wallet
auto sk = libzcash::SaplingSpendingKey::random();
ASSERT_TRUE(wallet.AddSaplingZKey(sk));
// verify wallet did add it
auto fvk = sk.full_viewing_key();
ASSERT_TRUE(wallet.HaveSaplingSpendingKey(fvk));
}
/**
* This test covers methods on CWallet
* GenerateNewZKey()