mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
refactor: RPC 'listlabels', encapsulate 'CWallet::ListAddrBookLabels' functionality
Mainly to not access 'm_address_book' externally.
This commit is contained in:
@@ -2373,6 +2373,20 @@ std::vector<CTxDestination> CWallet::ListAddrBookAddresses(const std::optional<A
|
||||
return result;
|
||||
}
|
||||
|
||||
std::set<std::string> CWallet::ListAddrBookLabels(const std::string& purpose) const
|
||||
{
|
||||
AssertLockHeld(cs_wallet);
|
||||
std::set<std::string> label_set;
|
||||
ForEachAddrBookEntry([&](const CTxDestination& _dest, const std::string& _label,
|
||||
const std::string& _purpose, bool _is_change) {
|
||||
if (_is_change) return;
|
||||
if (purpose.empty() || _purpose == purpose) {
|
||||
label_set.insert(_label);
|
||||
}
|
||||
});
|
||||
return label_set;
|
||||
}
|
||||
|
||||
bool ReserveDestination::GetReservedDestination(CTxDestination& dest, bool internal, bilingual_str& error)
|
||||
{
|
||||
m_spk_man = pwallet->GetScriptPubKeyMan(type, internal);
|
||||
|
||||
Reference in New Issue
Block a user