| 2607 | } |
| 2608 | |
| 2609 | util::Result<CTxDestination> CWallet::GetNewDestination(const OutputType type, const std::string& label) |
| 2610 | { |
| 2611 | LOCK(cs_wallet); |
| 2612 | auto spk_man = GetScriptPubKeyMan(type, /*internal=*/false); |
| 2613 | if (!spk_man) { |
| 2614 | return util::Error{strprintf(_("Error: No %s addresses available."), FormatOutputType(type))}; |
| 2615 | } |
| 2616 | |
| 2617 | auto op_dest = spk_man->GetNewDestination(type); |
| 2618 | if (op_dest) { |
| 2619 | SetAddressBook(*op_dest, label, AddressPurpose::RECEIVE); |
| 2620 | } |
| 2621 | |
| 2622 | return op_dest; |
| 2623 | } |
| 2624 | |
| 2625 | util::Result<CTxDestination> CWallet::GetNewChangeDestination(const OutputType type) |
| 2626 | { |