MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / Unlock

Method Unlock

src/wallet/wallet.cpp:35–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33string CWallet::defaultFileName("");
34
35bool CWallet::Unlock(const SecureString &strWalletPassphrase) {
36 CCrypter crypter;
37 CKeyingMaterial vMasterKey;
38
39 {
40 LOCK(cs_wallet);
41 for (const auto &pMasterKey : mapMasterKeys) {
42 if (!crypter.SetKeyFromPassphrase(strWalletPassphrase, pMasterKey.second.vchSalt,
43 pMasterKey.second.nDeriveIterations, pMasterKey.second.nDerivationMethod))
44 return false;
45 if (!crypter.Decrypt(pMasterKey.second.vchCryptedKey, vMasterKey))
46 continue; // try another master key
47 if (CCryptoKeyStore::Unlock(vMasterKey))
48 return true;
49 }
50 }
51
52 return false;
53}
54
55bool CWallet::ChangeWalletPassphrase(const SecureString &strOldWalletPassphrase,
56 const SecureString &strNewWalletPassphrase) {

Callers 1

walletpassphraseFunction · 0.45

Calls 2

SetKeyFromPassphraseMethod · 0.80
DecryptMethod · 0.45

Tested by

no test coverage detected