Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/walletdb.cpp
Show First 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | bool CWalletDB::WriteKey(const CPubKey &vchPubKey, const CPrivKey &vchPrivKey, | ||||
return WriteIC( | return WriteIC( | ||||
std::make_pair(std::string("key"), vchPubKey), | std::make_pair(std::string("key"), vchPubKey), | ||||
std::make_pair(vchPrivKey, Hash(vchKey.begin(), vchKey.end())), false); | std::make_pair(vchPrivKey, Hash(vchKey.begin(), vchKey.end())), false); | ||||
} | } | ||||
bool CWalletDB::WriteCryptedKey(const CPubKey &vchPubKey, | bool CWalletDB::WriteCryptedKey(const CPubKey &vchPubKey, | ||||
const std::vector<uint8_t> &vchCryptedSecret, | const std::vector<uint8_t> &vchCryptedSecret, | ||||
const CKeyMetadata &keyMeta) { | const CKeyMetadata &keyMeta) { | ||||
const bool fEraseUnencryptedKey = true; | |||||
if (!WriteIC(std::make_pair(std::string("keymeta"), vchPubKey), keyMeta)) { | if (!WriteIC(std::make_pair(std::string("keymeta"), vchPubKey), keyMeta)) { | ||||
return false; | return false; | ||||
} | } | ||||
if (!WriteIC(std::make_pair(std::string("ckey"), vchPubKey), | if (!WriteIC(std::make_pair(std::string("ckey"), vchPubKey), | ||||
vchCryptedSecret, false)) { | vchCryptedSecret, false)) { | ||||
return false; | return false; | ||||
} | } | ||||
if (fEraseUnencryptedKey) { | |||||
EraseIC(std::make_pair(std::string("key"), vchPubKey)); | EraseIC(std::make_pair(std::string("key"), vchPubKey)); | ||||
EraseIC(std::make_pair(std::string("wkey"), vchPubKey)); | EraseIC(std::make_pair(std::string("wkey"), vchPubKey)); | ||||
} | |||||
return true; | return true; | ||||
} | } | ||||
bool CWalletDB::WriteMasterKey(unsigned int nID, const CMasterKey &kMasterKey) { | bool CWalletDB::WriteMasterKey(unsigned int nID, const CMasterKey &kMasterKey) { | ||||
return WriteIC(std::make_pair(std::string("mkey"), nID), kMasterKey, true); | return WriteIC(std::make_pair(std::string("mkey"), nID), kMasterKey, true); | ||||
} | } | ||||
bool CWalletDB::WriteCScript(const uint160 &hash, const CScript &redeemScript) { | bool CWalletDB::WriteCScript(const uint160 &hash, const CScript &redeemScript) { | ||||
▲ Show 20 Lines • Show All 769 Lines • Show Last 20 Lines |