| 2497 | /// end ELEMENTS |
| 2498 | |
| 2499 | bool CWallet::GetNewDestination(const OutputType type, const std::string label, CTxDestination& dest, bilingual_str& error, bool add_blinding_key) |
| 2500 | { |
| 2501 | LOCK(cs_wallet); |
| 2502 | error.clear(); |
| 2503 | bool result = false; |
| 2504 | auto spk_man = GetScriptPubKeyMan(type, false /* internal */); |
| 2505 | if (spk_man) { |
| 2506 | spk_man->TopUp(); |
| 2507 | result = spk_man->GetNewDestination(type, dest, error); |
| 2508 | if (add_blinding_key) { |
| 2509 | CPubKey blinding_pubkey = GetBlindingPubKey(GetScriptForDestination(dest)); |
| 2510 | std::visit(SetBlindingPubKeyVisitor(blinding_pubkey), dest); |
| 2511 | } |
| 2512 | } else { |
| 2513 | error = strprintf(_("Error: No %s addresses available."), FormatOutputType(type)); |
| 2514 | } |
| 2515 | if (result) { |
| 2516 | SetAddressBook(dest, label, "receive"); |
| 2517 | } |
| 2518 | |
| 2519 | return result; |
| 2520 | } |
| 2521 | |
| 2522 | bool CWallet::GetNewChangeDestination(const OutputType type, CTxDestination& dest, bilingual_str& error, bool add_blinding_key) |
| 2523 | { |