MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / LoadEncryptionKey

Function LoadEncryptionKey

src/wallet/walletdb.cpp:394–419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

392}
393
394bool LoadEncryptionKey(CWallet* pwallet, DataStream& ssKey, DataStream& ssValue, std::string& strErr)
395{
396 LOCK(pwallet->cs_wallet);
397 try {
398 // Master encryption key is loaded into only the wallet and not any of the ScriptPubKeyMans.
399 unsigned int nID;
400 ssKey >> nID;
401 CMasterKey kMasterKey;
402 ssValue >> kMasterKey;
403 if(pwallet->mapMasterKeys.contains(nID))
404 {
405 strErr = strprintf("Error reading wallet database: duplicate CMasterKey id %u", nID);
406 return false;
407 }
408 pwallet->mapMasterKeys[nID] = kMasterKey;
409 if (pwallet->nMasterKeyMaxID < nID)
410 pwallet->nMasterKeyMaxID = nID;
411
412 } catch (const std::exception& e) {
413 if (strErr.empty()) {
414 strErr = e.what();
415 }
416 return false;
417 }
418 return true;
419}
420
421bool LoadHDChain(CWallet* pwallet, DataStream& ssValue, std::string& strErr)
422{

Callers 1

walletdb.cppFile · 0.85

Calls 3

containsMethod · 0.45
emptyMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected