From 0adba6789b1b36387ee06248273540fc30dd9d40 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Wed, 1 Aug 2018 15:58:32 +0100 Subject: [PATCH] Add Sapling decryption check to CCryptoKeyStore::Unlock() --- src/wallet/crypter.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/wallet/crypter.cpp b/src/wallet/crypter.cpp index a8c0e0706..ede017c8d 100644 --- a/src/wallet/crypter.cpp +++ b/src/wallet/crypter.cpp @@ -232,6 +232,21 @@ bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn) if (fDecryptionThoroughlyChecked) break; } + CryptedSaplingSpendingKeyMap::const_iterator miSapling = mapCryptedSaplingSpendingKeys.begin(); + for (; miSapling != mapCryptedSaplingSpendingKeys.end(); ++miSapling) + { + const libzcash::SaplingFullViewingKey &fvk = (*miSapling).first; + const std::vector &vchCryptedSecret = (*miSapling).second; + libzcash::SaplingSpendingKey sk; + if (!DecryptSaplingSpendingKey(vMasterKeyIn, vchCryptedSecret, fvk, sk)) + { + keyFail = true; + break; + } + keyPass = true; + if (fDecryptionThoroughlyChecked) + break; + } if (keyPass && keyFail) { LogPrintf("The wallet is probably corrupted: Some keys decrypt but not all.\n");