Add Sapling decryption check to CCryptoKeyStore::Unlock()

This commit is contained in:
Jack Grigg 2018-08-01 15:58:32 +01:00
parent e8a949c153
commit 0adba6789b
No known key found for this signature in database
GPG Key ID: 1B8D649257DB0829
1 changed files with 15 additions and 0 deletions

View File

@ -232,6 +232,21 @@ bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn)
if (fDecryptionThoroughlyChecked) if (fDecryptionThoroughlyChecked)
break; break;
} }
CryptedSaplingSpendingKeyMap::const_iterator miSapling = mapCryptedSaplingSpendingKeys.begin();
for (; miSapling != mapCryptedSaplingSpendingKeys.end(); ++miSapling)
{
const libzcash::SaplingFullViewingKey &fvk = (*miSapling).first;
const std::vector<unsigned char> &vchCryptedSecret = (*miSapling).second;
libzcash::SaplingSpendingKey sk;
if (!DecryptSaplingSpendingKey(vMasterKeyIn, vchCryptedSecret, fvk, sk))
{
keyFail = true;
break;
}
keyPass = true;
if (fDecryptionThoroughlyChecked)
break;
}
if (keyPass && keyFail) if (keyPass && keyFail)
{ {
LogPrintf("The wallet is probably corrupted: Some keys decrypt but not all.\n"); LogPrintf("The wallet is probably corrupted: Some keys decrypt but not all.\n");