Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 471 Lines • ▼ Show 20 Lines | bool CWallet::RemoveWatchOnly(const CScript &dest) { | ||||
return WalletBatch(*database).EraseWatchOnly(dest); | return WalletBatch(*database).EraseWatchOnly(dest); | ||||
} | } | ||||
bool CWallet::LoadWatchOnly(const CScript &dest) { | bool CWallet::LoadWatchOnly(const CScript &dest) { | ||||
return CCryptoKeyStore::AddWatchOnly(dest); | return CCryptoKeyStore::AddWatchOnly(dest); | ||||
} | } | ||||
bool CWallet::Unlock(const SecureString &strWalletPassphrase) { | bool CWallet::Unlock(const SecureString &strWalletPassphrase, | ||||
bool accept_no_keys) { | |||||
CCrypter crypter; | CCrypter crypter; | ||||
CKeyingMaterial _vMasterKey; | CKeyingMaterial _vMasterKey; | ||||
{ | |||||
LOCK(cs_wallet); | LOCK(cs_wallet); | ||||
for (const MasterKeyMap::value_type &pMasterKey : mapMasterKeys) { | for (const MasterKeyMap::value_type &pMasterKey : mapMasterKeys) { | ||||
if (!crypter.SetKeyFromPassphrase( | if (!crypter.SetKeyFromPassphrase( | ||||
strWalletPassphrase, pMasterKey.second.vchSalt, | strWalletPassphrase, pMasterKey.second.vchSalt, | ||||
pMasterKey.second.nDeriveIterations, | pMasterKey.second.nDeriveIterations, | ||||
pMasterKey.second.nDerivationMethod)) { | pMasterKey.second.nDerivationMethod)) { | ||||
return false; | return false; | ||||
} | } | ||||
if (!crypter.Decrypt(pMasterKey.second.vchCryptedKey, | |||||
if (!crypter.Decrypt(pMasterKey.second.vchCryptedKey, _vMasterKey)) { | _vMasterKey)) { | ||||
// try another master key | // try another master key | ||||
continue; | continue; | ||||
} | } | ||||
if (CCryptoKeyStore::Unlock(_vMasterKey, accept_no_keys)) { | |||||
if (CCryptoKeyStore::Unlock(_vMasterKey)) { | |||||
return true; | return true; | ||||
} | } | ||||
} | } | ||||
} | |||||
return false; | return false; | ||||
} | } | ||||
bool CWallet::ChangeWalletPassphrase( | bool CWallet::ChangeWalletPassphrase( | ||||
const SecureString &strOldWalletPassphrase, | const SecureString &strOldWalletPassphrase, | ||||
const SecureString &strNewWalletPassphrase) { | const SecureString &strNewWalletPassphrase) { | ||||
bool fWasLocked = IsLocked(); | bool fWasLocked = IsLocked(); | ||||
▲ Show 20 Lines • Show All 4,456 Lines • Show Last 20 Lines |