From 8dd1dbcfe41c551113faeb44c05afdf0da20dca4 Mon Sep 17 00:00:00 2001 From: Jay Graber Date: Wed, 11 Jul 2018 14:01:07 -0700 Subject: [PATCH] Add Sapling to rpc_wallet_z_importexport test --- src/test/rpc_wallet_tests.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/test/rpc_wallet_tests.cpp b/src/test/rpc_wallet_tests.cpp index 49f436487..5064526ba 100644 --- a/src/test/rpc_wallet_tests.cpp +++ b/src/test/rpc_wallet_tests.cpp @@ -564,7 +564,7 @@ BOOST_AUTO_TEST_CASE(rpc_wallet_z_importexport) // verify import and export key for (int i = 0; i < n1; i++) { - // create a random key locally + // create a random Sprout key locally auto testSpendingKey = libzcash::SproutSpendingKey::random(); auto testPaymentAddress = testSpendingKey.address(); std::string testAddr = EncodePaymentAddress(testPaymentAddress); @@ -572,6 +572,15 @@ BOOST_AUTO_TEST_CASE(rpc_wallet_z_importexport) BOOST_CHECK_NO_THROW(CallRPC(string("z_importkey ") + testKey)); BOOST_CHECK_NO_THROW(retValue = CallRPC(string("z_exportkey ") + testAddr)); BOOST_CHECK_EQUAL(retValue.get_str(), testKey); + + // create a random Sapling key locally + auto testSaplingSpendingKey = libzcash::SaplingSpendingKey::random(); + auto testSaplingPaymentAddress = testSaplingSpendingKey.default_address(); + std::string testSaplingAddr = EncodePaymentAddress(testSaplingPaymentAddress); + std::string testSaplingKey = EncodeSpendingKey(testSaplingSpendingKey); + BOOST_CHECK_NO_THROW(CallRPC(string("z_importkey ") + testSaplingKey)); + BOOST_CHECK_NO_THROW(retValue = CallRPC(string("z_exportkey ") + testSaplingAddr)); + BOOST_CHECK_EQUAL(retValue.get_str(), testSaplingKey); } // Verify we can list the keys imported