MCPcopy Create free account
hub / github.com/ElementsProject/elements / Unlock

Method Unlock

src/wallet/wallet.cpp:457–480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

455}
456
457bool CWallet::Unlock(const SecureString& strWalletPassphrase, bool accept_no_keys)
458{
459 CCrypter crypter;
460 CKeyingMaterial _vMasterKey;
461
462 {
463 LOCK(cs_wallet);
464 for (const MasterKeyMap::value_type& pMasterKey : mapMasterKeys)
465 {
466 if(!crypter.SetKeyFromPassphrase(strWalletPassphrase, pMasterKey.second.vchSalt, pMasterKey.second.nDeriveIterations, pMasterKey.second.nDerivationMethod))
467 return false;
468 if (!crypter.Decrypt(pMasterKey.second.vchCryptedKey, _vMasterKey))
469 continue; // try another master key
470 if (Unlock(_vMasterKey, accept_no_keys)) {
471 // Now that we've unlocked, upgrade the key metadata
472 UpgradeKeyMetadata();
473 // Now that we've unlocked, upgrade the descriptor cache
474 UpgradeDescriptorCache();
475 return true;
476 }
477 }
478 }
479 return false;
480}
481
482bool CWallet::ChangeWalletPassphrase(const SecureString& strOldWalletPassphrase, const SecureString& strNewWalletPassphrase)
483{

Callers 15

CreateWalletFunction · 0.80
unlockMethod · 0.80
walletpassphraseFunction · 0.80
RunBenchmarkMethod · 0.80
LOCKS_EXCLUDEDMethod · 0.80
ScheduleMethod · 0.80
BackgroundThreadMainMethod · 0.80
UNLOCK_FUNCTIONFunction · 0.80
ThreadBodyFunction · 0.80
ScheduleMethod · 0.80
BackgroundThreadMainMethod · 0.80
LOCKS_EXCLUDEDMethod · 0.80

Calls 3

SetKeyFromPassphraseMethod · 0.80
DecryptMethod · 0.45
CheckDecryptionKeyMethod · 0.45

Tested by 3

ThreadBodyFunction · 0.64
LOCKS_EXCLUDEDMethod · 0.64