Skip to content

Commit

Permalink
Dont run full check every time we decrypt wallet.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBlueMatt committed Aug 11, 2014
1 parent 1e21c17 commit a35b55b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/crypter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn)
break;
}
keyPass = true;
if (fDecryptionThoroughlyChecked)
break;
}
if (keyPass && keyFail)
{
Expand All @@ -187,6 +189,7 @@ bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn)
if (keyFail || !keyPass)
return false;
vMasterKey = vMasterKeyIn;
fDecryptionThoroughlyChecked = true;
}
NotifyStatusChanged(this);
return true;
Expand Down
5 changes: 4 additions & 1 deletion src/crypter.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ class CCryptoKeyStore : public CBasicKeyStore
// if fUseCrypto is false, vMasterKey must be empty
bool fUseCrypto;

// keeps track of whether Unlock has run a thourough check before
bool fDecryptionThoroughlyChecked;

protected:
bool SetCrypted();

Expand All @@ -130,7 +133,7 @@ class CCryptoKeyStore : public CBasicKeyStore
bool Unlock(const CKeyingMaterial& vMasterKeyIn);

public:
CCryptoKeyStore() : fUseCrypto(false)
CCryptoKeyStore() : fUseCrypto(false), fDecryptionThoroughlyChecked(false)
{
}

Expand Down

0 comments on commit a35b55b

Please sign in to comment.