Persist Sapling payment address to IVK map
This ensures we remember any diversified addresses manually generated outside the wallet.
This commit is contained in:
@@ -174,6 +174,28 @@ bool CWallet::AddSaplingZKey(
|
||||
return true;
|
||||
}
|
||||
|
||||
// Add payment address -> incoming viewing key map entry
|
||||
bool CWallet::AddSaplingIncomingViewingKey(
|
||||
const libzcash::SaplingIncomingViewingKey &ivk,
|
||||
const libzcash::SaplingPaymentAddress &addr)
|
||||
{
|
||||
AssertLockHeld(cs_wallet); // mapSaplingZKeyMetadata
|
||||
|
||||
if (!CCryptoKeyStore::AddSaplingIncomingViewingKey(ivk, addr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!fFileBacked) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!IsCrypted()) {
|
||||
return CWalletDB(strWalletFile).WriteSaplingPaymentAddress(addr, ivk);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Add spending key to keystore and persist to disk
|
||||
bool CWallet::AddSproutZKey(const libzcash::SproutSpendingKey &key)
|
||||
@@ -365,6 +387,13 @@ bool CWallet::LoadSaplingZKey(const libzcash::SaplingExtendedSpendingKey &key)
|
||||
return CCryptoKeyStore::AddSaplingSpendingKey(key, key.DefaultAddress());
|
||||
}
|
||||
|
||||
bool CWallet::LoadSaplingPaymentAddress(
|
||||
const libzcash::SaplingPaymentAddress &addr,
|
||||
const libzcash::SaplingIncomingViewingKey &ivk)
|
||||
{
|
||||
return CCryptoKeyStore::AddSaplingIncomingViewingKey(ivk, addr);
|
||||
}
|
||||
|
||||
bool CWallet::LoadZKey(const libzcash::SproutSpendingKey &key)
|
||||
{
|
||||
return CCryptoKeyStore::AddSproutSpendingKey(key);
|
||||
|
||||
Reference in New Issue
Block a user