MCPcopy Create free account
hub / github.com/LUX-Core/lux / Unlock

Method Unlock

src/wallet.cpp:439–468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

437}
438
439bool CWallet::Unlock(const SecureString& strWalletPassphrase, bool stakingOnly)
440{
441 SecureString strWalletPassphraseFinal;
442
443 if (!IsLocked()) {
444 fWalletUnlockStakingOnly = stakingOnly;
445 return true;
446 }
447
448 strWalletPassphraseFinal = strWalletPassphrase;
449
450
451 CCrypter crypter;
452 CKeyingMaterial _vMasterKey;
453
454 {
455 LOCK(cs_wallet);
456 for (const MasterKeyMap::value_type& pMasterKey : mapMasterKeys) {
457 if (!crypter.SetKeyFromPassphrase(strWalletPassphraseFinal, pMasterKey.second.vchSalt, pMasterKey.second.nDeriveIterations, pMasterKey.second.nDerivationMethod))
458 return false;
459 if (!crypter.Decrypt(pMasterKey.second.vchCryptedKey, _vMasterKey))
460 continue; // try another master key
461 if (CCryptoKeyStore::Unlock(_vMasterKey)) {
462 fWalletUnlockStakingOnly = stakingOnly;
463 return true;
464 }
465 }
466 }
467 return false;
468}
469
470bool CWallet::ChangeWalletPassphrase(const SecureString& strOldWalletPassphrase, const SecureString& strNewWalletPassphrase)
471{

Callers 3

walletpassphraseFunction · 0.45
UnlockRangeMethod · 0.45
masternodeFunction · 0.45

Calls 2

SetKeyFromPassphraseMethod · 0.80
DecryptMethod · 0.45

Tested by

no test coverage detected