| 274 | } |
| 275 | |
| 276 | bool LegacyScriptPubKeyMan::Encrypt(const CKeyingMaterial& master_key, WalletBatch* batch) |
| 277 | { |
| 278 | LOCK(cs_KeyStore); |
| 279 | encrypted_batch = batch; |
| 280 | if (!mapCryptedKeys.empty()) { |
| 281 | encrypted_batch = nullptr; |
| 282 | return false; |
| 283 | } |
| 284 | |
| 285 | KeyMap keys_to_encrypt; |
| 286 | keys_to_encrypt.swap(mapKeys); // Clear mapKeys so AddCryptedKeyInner will succeed. |
| 287 | for (const KeyMap::value_type& mKey : keys_to_encrypt) |
| 288 | { |
| 289 | const CKey &key = mKey.second; |
| 290 | CPubKey vchPubKey = key.GetPubKey(); |
| 291 | CKeyingMaterial vchSecret(key.begin(), key.end()); |
| 292 | std::vector<unsigned char> vchCryptedSecret; |
| 293 | if (!EncryptSecret(master_key, vchSecret, vchPubKey.GetHash(), vchCryptedSecret)) { |
| 294 | encrypted_batch = nullptr; |
| 295 | return false; |
| 296 | } |
| 297 | if (!AddCryptedKey(vchPubKey, vchCryptedSecret)) { |
| 298 | encrypted_batch = nullptr; |
| 299 | return false; |
| 300 | } |
| 301 | } |
| 302 | encrypted_batch = nullptr; |
| 303 | return true; |
| 304 | } |
| 305 | |
| 306 | bool LegacyScriptPubKeyMan::GetReservedDestination(const OutputType type, bool internal, CTxDestination& address, int64_t& index, CKeyPool& keypool, bilingual_str& error) |
| 307 | { |
nothing calls this directly
no test coverage detected