| 57 | } |
| 58 | |
| 59 | bool WalletBatch::WriteKey(const CPubKey& vchPubKey, const CPrivKey& vchPrivKey, const CKeyMetadata& keyMeta) |
| 60 | { |
| 61 | if (!WriteIC(std::make_pair(std::string("keymeta"), vchPubKey), keyMeta, false)) { |
| 62 | return false; |
| 63 | } |
| 64 | |
| 65 | // hash pubkey/privkey to accelerate wallet load |
| 66 | std::vector<unsigned char> vchKey; |
| 67 | vchKey.reserve(vchPubKey.size() + vchPrivKey.size()); |
| 68 | vchKey.insert(vchKey.end(), vchPubKey.begin(), vchPubKey.end()); |
| 69 | vchKey.insert(vchKey.end(), vchPrivKey.begin(), vchPrivKey.end()); |
| 70 | |
| 71 | return WriteIC(std::make_pair(std::string("key"), vchPubKey), std::make_pair(vchPrivKey, Hash(vchKey.begin(), vchKey.end())), false); |
| 72 | } |
| 73 | |
| 74 | bool WalletBatch::WriteCryptedKey(const CPubKey& vchPubKey, |
| 75 | const std::vector<unsigned char>& vchCryptedSecret, |