| 91 | } |
| 92 | |
| 93 | bool CWalletDB::WriteKey(const CPubKey& vchPubKey, const CPrivKey& vchPrivKey, const CKeyMetadata& keyMeta) |
| 94 | { |
| 95 | nWalletDBUpdateCounter++; |
| 96 | |
| 97 | if (!Write(std::make_pair(std::string("keymeta"), vchPubKey), |
| 98 | keyMeta, false)) |
| 99 | return false; |
| 100 | |
| 101 | // hash pubkey/privkey to accelerate wallet load |
| 102 | std::vector<unsigned char> vchKey; |
| 103 | vchKey.reserve(vchPubKey.size() + vchPrivKey.size()); |
| 104 | vchKey.insert(vchKey.end(), vchPubKey.begin(), vchPubKey.end()); |
| 105 | vchKey.insert(vchKey.end(), vchPrivKey.begin(), vchPrivKey.end()); |
| 106 | |
| 107 | return Write(std::make_pair(std::string("key"), vchPubKey), std::make_pair(vchPrivKey, Hash(vchKey.begin(), vchKey.end())), false); |
| 108 | } |
| 109 | |
| 110 | bool CWalletDB::WriteCryptedKey(const CPubKey& vchPubKey, |
| 111 | const std::vector<unsigned char>& vchCryptedSecret, |