Auto merge of #3491 - Eirik0:3218-sapling-import-export-wallet, r=str4d

Add Sapling support to z_importwallet and z_exportwallet

Includes code adapted from upstream PR https://github.com/bitcoin/bitcoin/pull/8323

Closes #3218.
This commit is contained in:
Homu
2018-09-19 12:15:48 -07:00
10 changed files with 275 additions and 112 deletions

View File

@@ -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();
@@ -116,7 +116,7 @@ TEST(wallet_zkeys_tests, store_and_load_zkeys) {
ASSERT_TRUE(wallet.LoadZKeyMetadata(addr, meta));
// check metadata is the same
CKeyMetadata m= wallet.mapZKeyMetadata[addr];
CKeyMetadata m= wallet.mapSproutZKeyMetadata[addr];
ASSERT_EQ(m.nCreateTime, now);
}
@@ -215,7 +215,7 @@ TEST(wallet_zkeys_tests, write_zkey_direct_to_db) {
ASSERT_EQ(1, addrs.size());
// wallet should have default metadata for addr with null createtime
CKeyMetadata m = wallet.mapZKeyMetadata[addr];
CKeyMetadata m = wallet.mapSproutZKeyMetadata[addr];
ASSERT_EQ(m.nCreateTime, 0);
ASSERT_NE(m.nCreateTime, now);
@@ -235,7 +235,7 @@ TEST(wallet_zkeys_tests, write_zkey_direct_to_db) {
ASSERT_EQ(2, addrs.size());
// check metadata is now the same
m = wallet.mapZKeyMetadata[addr];
m = wallet.mapSproutZKeyMetadata[addr];
ASSERT_EQ(m.nCreateTime, now);
}