Pass SaplingPaymentAddress to store through the CKeyStore
This commit is contained in:
@@ -354,12 +354,14 @@ bool CCryptoKeyStore::AddSpendingKey(const libzcash::SproutSpendingKey &sk)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CCryptoKeyStore::AddSaplingSpendingKey(const libzcash::SaplingSpendingKey &sk)
|
||||
bool CCryptoKeyStore::AddSaplingSpendingKey(
|
||||
const libzcash::SaplingSpendingKey &sk,
|
||||
const boost::optional<libzcash::SaplingPaymentAddress> &defaultAddr)
|
||||
{
|
||||
{
|
||||
LOCK(cs_SpendingKeyStore);
|
||||
if (!IsCrypted()) {
|
||||
return CBasicKeyStore::AddSaplingSpendingKey(sk);
|
||||
return CBasicKeyStore::AddSaplingSpendingKey(sk, defaultAddr);
|
||||
}
|
||||
|
||||
if (IsLocked()) {
|
||||
@@ -375,7 +377,7 @@ bool CCryptoKeyStore::AddSaplingSpendingKey(const libzcash::SaplingSpendingKey &
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!AddCryptedSaplingSpendingKey(fvk, vchCryptedSecret)) {
|
||||
if (!AddCryptedSaplingSpendingKey(fvk, vchCryptedSecret, defaultAddr)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -397,8 +399,10 @@ bool CCryptoKeyStore::AddCryptedSpendingKey(const libzcash::SproutPaymentAddress
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CCryptoKeyStore::AddCryptedSaplingSpendingKey(const libzcash::SaplingFullViewingKey &fvk,
|
||||
const std::vector<unsigned char> &vchCryptedSecret)
|
||||
bool CCryptoKeyStore::AddCryptedSaplingSpendingKey(
|
||||
const libzcash::SaplingFullViewingKey &fvk,
|
||||
const std::vector<unsigned char> &vchCryptedSecret,
|
||||
const boost::optional<libzcash::SaplingPaymentAddress> &defaultAddr)
|
||||
{
|
||||
{
|
||||
LOCK(cs_SpendingKeyStore);
|
||||
@@ -406,6 +410,11 @@ bool CCryptoKeyStore::AddCryptedSaplingSpendingKey(const libzcash::SaplingFullVi
|
||||
return false;
|
||||
}
|
||||
|
||||
// if SaplingFullViewingKey is not in SaplingFullViewingKeyMap, add it
|
||||
if (!AddSaplingFullViewingKey(fvk, defaultAddr)){
|
||||
return false;
|
||||
}
|
||||
|
||||
mapCryptedSaplingSpendingKeys[fvk] = vchCryptedSecret;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user