From bc6344b350e24de6137a631aab5f37c3362ddbde Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Wed, 1 Aug 2018 23:22:32 +0100 Subject: [PATCH] Add CWallet::AddCryptedSaplingSpendingKey() hook To be filled in when we implement Sapling persistence to disk. --- src/wallet/wallet.cpp | 13 +++++++++++++ src/wallet/wallet.h | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 7905c2368..373bb9251 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -264,6 +264,19 @@ bool CWallet::AddCryptedSpendingKey(const libzcash::SproutPaymentAddress &addres return false; } +bool CWallet::AddCryptedSaplingSpendingKey(const libzcash::SaplingFullViewingKey &fvk, + const std::vector &vchCryptedSecret) +{ + if (!CCryptoKeyStore::AddCryptedSaplingSpendingKey(fvk, vchCryptedSecret)) + return false; + if (!fFileBacked) + return true; + { + // TODO: Sapling - Write to disk + } + return false; +} + bool CWallet::LoadKeyMetadata(const CPubKey &pubkey, const CKeyMetadata &meta) { AssertLockHeld(cs_wallet); // mapKeyMetadata diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index d395d0dbb..7cff16b13 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -999,7 +999,7 @@ public: bool RemoveViewingKey(const libzcash::SproutViewingKey &vk); //! Adds a viewing key to the store, without saving it to disk (used by LoadWallet) bool LoadViewingKey(const libzcash::SproutViewingKey &dest); - + /** * Sapling ZKeys */ @@ -1007,6 +1007,8 @@ public: libzcash::SaplingPaymentAddress GenerateNewSaplingZKey(); //! Adds Sapling spending key to the store, and saves it to disk bool AddSaplingZKey(const libzcash::SaplingSpendingKey &key); + bool AddCryptedSaplingSpendingKey(const libzcash::SaplingFullViewingKey &fvk, + const std::vector &vchCryptedSecret); /** * Increment the next transaction order id