Pass SaplingPaymentAddress to store through the CKeyStore
This commit is contained in:
@@ -118,7 +118,7 @@ SaplingPaymentAddress CWallet::GenerateNewSaplingZKey()
|
||||
int64_t nCreationTime = GetTime();
|
||||
mapSaplingZKeyMetadata[addr] = CKeyMetadata(nCreationTime);
|
||||
|
||||
if (!AddSaplingZKey(sk)) {
|
||||
if (!AddSaplingZKey(sk, addr)) {
|
||||
throw std::runtime_error("CWallet::GenerateNewSaplingZKey(): AddSaplingZKey failed");
|
||||
}
|
||||
// return default sapling payment address.
|
||||
@@ -126,11 +126,13 @@ SaplingPaymentAddress CWallet::GenerateNewSaplingZKey()
|
||||
}
|
||||
|
||||
// Add spending key to keystore
|
||||
bool CWallet::AddSaplingZKey(const libzcash::SaplingSpendingKey &sk)
|
||||
bool CWallet::AddSaplingZKey(
|
||||
const libzcash::SaplingSpendingKey &sk,
|
||||
const boost::optional<libzcash::SaplingPaymentAddress> &defaultAddr)
|
||||
{
|
||||
AssertLockHeld(cs_wallet); // mapSaplingZKeyMetadata
|
||||
|
||||
if (!CCryptoKeyStore::AddSaplingSpendingKey(sk)) {
|
||||
if (!CCryptoKeyStore::AddSaplingSpendingKey(sk, defaultAddr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -265,9 +267,10 @@ bool CWallet::AddCryptedSpendingKey(const libzcash::SproutPaymentAddress &addres
|
||||
}
|
||||
|
||||
bool CWallet::AddCryptedSaplingSpendingKey(const libzcash::SaplingFullViewingKey &fvk,
|
||||
const std::vector<unsigned char> &vchCryptedSecret)
|
||||
const std::vector<unsigned char> &vchCryptedSecret,
|
||||
const boost::optional<libzcash::SaplingPaymentAddress> &defaultAddr)
|
||||
{
|
||||
if (!CCryptoKeyStore::AddCryptedSaplingSpendingKey(fvk, vchCryptedSecret))
|
||||
if (!CCryptoKeyStore::AddCryptedSaplingSpendingKey(fvk, vchCryptedSecret, defaultAddr))
|
||||
return false;
|
||||
if (!fFileBacked)
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user