| 949 | } |
| 950 | |
| 951 | bool DescriptorScriptPubKeyMan::Encrypt(const CKeyingMaterial& master_key, WalletBatch* batch) |
| 952 | { |
| 953 | LOCK(cs_desc_man); |
| 954 | if (!m_map_crypted_keys.empty()) { |
| 955 | return false; |
| 956 | } |
| 957 | |
| 958 | for (const KeyMap::value_type& key_in : m_map_keys) |
| 959 | { |
| 960 | const CKey &key = key_in.second; |
| 961 | CPubKey pubkey = key.GetPubKey(); |
| 962 | CKeyingMaterial secret{UCharCast(key.begin()), UCharCast(key.end())}; |
| 963 | std::vector<unsigned char> crypted_secret; |
| 964 | if (!EncryptSecret(master_key, secret, pubkey.GetHash(), crypted_secret)) { |
| 965 | return false; |
| 966 | } |
| 967 | m_map_crypted_keys[pubkey.GetID()] = make_pair(pubkey, crypted_secret); |
| 968 | batch->WriteCryptedDescriptorKey(GetID(), pubkey, crypted_secret); |
| 969 | } |
| 970 | m_map_keys.clear(); |
| 971 | return true; |
| 972 | } |
| 973 | |
| 974 | util::Result<CTxDestination> DescriptorScriptPubKeyMan::GetReservedDestination(const OutputType type, bool internal, int64_t& index) |
| 975 | { |
nothing calls this directly
no test coverage detected