wallet: Switch from SaplingSpendingKey to SaplingExtendedSpendingKey
The wallet now only stores Sapling extended spending keys, and thus can only be used with keys generated from an HDSeed via ZIP 32. Note that not all Sapling keys in the wallet will correspond to the wallet's HDSeed, as a standalone Sapling xsk can be imported via z_importkey. However, it must have been generated from a seed itself, and thus is more likely to be backed up elsewhere.
This commit is contained in:
@@ -568,6 +568,10 @@ BOOST_AUTO_TEST_CASE(rpc_wallet_z_importexport)
|
||||
pwalletMain->GetSaplingPaymentAddresses(saplingAddrs);
|
||||
BOOST_CHECK(saplingAddrs.empty());
|
||||
|
||||
std::vector<unsigned char, secure_allocator<unsigned char>> rawSeed(32);
|
||||
HDSeed seed(rawSeed);
|
||||
auto m = libzcash::SaplingExtendedSpendingKey::Master(seed);
|
||||
|
||||
// verify import and export key
|
||||
for (int i = 0; i < n1; i++) {
|
||||
// create a random Sprout key locally
|
||||
@@ -578,10 +582,10 @@ 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();
|
||||
auto testSaplingSpendingKey = m.Derive(i);
|
||||
auto testSaplingPaymentAddress = testSaplingSpendingKey.DefaultAddress();
|
||||
std::string testSaplingAddr = EncodePaymentAddress(testSaplingPaymentAddress);
|
||||
std::string testSaplingKey = EncodeSpendingKey(testSaplingSpendingKey);
|
||||
BOOST_CHECK_NO_THROW(CallRPC(string("z_importkey ") + testSaplingKey));
|
||||
|
||||
Reference in New Issue
Block a user