| 91 | } |
| 92 | |
| 93 | bool CWalletDB::WriteCryptedKey(const CPubKey& vchPubKey, |
| 94 | const std::vector<unsigned char>& vchCryptedSecret, |
| 95 | const CKeyMetadata &keyMeta) |
| 96 | { |
| 97 | const bool fEraseUnencryptedKey = true; |
| 98 | nWalletDBUpdated++; |
| 99 | |
| 100 | if (!Write(std::make_pair(std::string("keymeta"), vchPubKey), |
| 101 | keyMeta)) |
| 102 | return false; |
| 103 | |
| 104 | if (!Write(std::make_pair(std::string("ckey"), vchPubKey), vchCryptedSecret, false)) |
| 105 | return false; |
| 106 | if (fEraseUnencryptedKey) |
| 107 | { |
| 108 | Erase(std::make_pair(std::string("key"), vchPubKey)); |
| 109 | Erase(std::make_pair(std::string("wkey"), vchPubKey)); |
| 110 | } |
| 111 | return true; |
| 112 | } |
| 113 | |
| 114 | bool CWalletDB::WriteMasterKey(unsigned int nID, const CMasterKey& kMasterKey) |
| 115 | { |