Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/crypter.cpp
Show First 20 Lines • Show All 193 Lines • ▼ Show 20 Lines | if (!SetCrypted()) { | ||||
LOCK(cs_KeyStore); | LOCK(cs_KeyStore); | ||||
vMasterKey.clear(); | vMasterKey.clear(); | ||||
} | } | ||||
NotifyStatusChanged(this); | NotifyStatusChanged(this); | ||||
return true; | return true; | ||||
} | } | ||||
bool CCryptoKeyStore::Unlock(const CKeyingMaterial &vMasterKeyIn) { | bool CCryptoKeyStore::Unlock(const CKeyingMaterial &vMasterKeyIn, | ||||
bool accept_no_keys) { | |||||
{ | { | ||||
LOCK(cs_KeyStore); | LOCK(cs_KeyStore); | ||||
if (!SetCrypted()) { | if (!SetCrypted()) { | ||||
return false; | return false; | ||||
} | } | ||||
// Always pass when there are no encrypted keys | // Always pass when there are no encrypted keys | ||||
bool keyPass = mapCryptedKeys.empty(); | bool keyPass = mapCryptedKeys.empty(); | ||||
Show All 12 Lines | bool CCryptoKeyStore::Unlock(const CKeyingMaterial &vMasterKeyIn, | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
if (keyPass && keyFail) { | if (keyPass && keyFail) { | ||||
LogPrintf("The wallet is probably corrupted: Some keys decrypt but " | LogPrintf("The wallet is probably corrupted: Some keys decrypt but " | ||||
"not all.\n"); | "not all.\n"); | ||||
assert(false); | assert(false); | ||||
} | } | ||||
if (keyFail || !keyPass) { | if (keyFail || (!keyPass && !accept_no_keys)) { | ||||
return false; | return false; | ||||
} | } | ||||
vMasterKey = vMasterKeyIn; | vMasterKey = vMasterKeyIn; | ||||
fDecryptionThoroughlyChecked = true; | fDecryptionThoroughlyChecked = true; | ||||
} | } | ||||
NotifyStatusChanged(this); | NotifyStatusChanged(this); | ||||
return true; | return true; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 111 Lines • Show Last 20 Lines |