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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user