Dynamic generation of zaddrs not stored in wallet

These zaddrs can be created via:

    z_getnewaddress donotremember

and return a zaddr like normal usage, but without storing it's extended
spending key in wallet.dat. This will be utilized by Sietch to generate
dynamic zdust for every shielded transaction, preventing attacks related
to having chain-wide fixed pools of zdust.
This commit is contained in:
Duke Leto
2020-01-07 09:26:49 -05:00
parent b175a2df60
commit c58fef0d01
4 changed files with 22 additions and 14 deletions

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin Core developers
// Copyright (c) 2019 The Hush developers
// Copyright (c) 2019-2020 The Hush developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -127,7 +127,7 @@ libzcash::SproutPaymentAddress CWallet::GenerateNewSproutZKey()
}
// Generate a new Sapling spending key and return its public payment address
SaplingPaymentAddress CWallet::GenerateNewSaplingZKey()
SaplingPaymentAddress CWallet::GenerateNewSaplingZKey(bool addToWallet)
{
AssertLockHeld(cs_wallet); // mapSaplingZKeyMetadata
@@ -168,7 +168,7 @@ SaplingPaymentAddress CWallet::GenerateNewSaplingZKey()
mapSaplingZKeyMetadata[ivk] = metadata;
auto addr = xsk.DefaultAddress();
if (!AddSaplingZKey(xsk, addr)) {
if (addToWallet && !AddSaplingZKey(xsk, addr)) {
throw std::runtime_error("CWallet::GenerateNewSaplingZKey(): AddSaplingZKey failed");
}
// return default sapling payment address.