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

Method Unlock

src/wallet/crypter.cpp:178–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn)
179{
180 {
181 LOCK(cs_KeyStore);
182 if (!SetCrypted())
183 return false;
184
185 bool keyPass = false;
186 bool keyFail = false;
187 CryptedKeyMap::const_iterator mi = mapCryptedKeys.begin();
188 for (; mi != mapCryptedKeys.end(); ++mi)
189 {
190 const CPubKey &vchPubKey = (*mi).second.first;
191 const std::vector<unsigned char> &vchCryptedSecret = (*mi).second.second;
192 CKey key;
193 if (!DecryptKey(vMasterKeyIn, vchCryptedSecret, vchPubKey, key))
194 {
195 keyFail = true;
196 break;
197 }
198 keyPass = true;
199 if (fDecryptionThoroughlyChecked)
200 break;
201 }
202 if (keyPass && keyFail)
203 {
204 LogPrintf("The wallet is probably corrupted: Some keys decrypt but not all.\n");
205 assert(false);
206 }
207 if (keyFail || !keyPass)
208 return false;
209 vMasterKey = vMasterKeyIn;
210 fDecryptionThoroughlyChecked = true;
211 }
212 NotifyStatusChanged(this);
213 return true;
214}
215
216bool CCryptoKeyStore::AddKeyPubKey(const CKey& key, const CPubKey &pubkey)
217{

Callers

nothing calls this directly

Calls 3

DecryptKeyFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected