[#CConnman-GetAddresses]
= xref:CConnman.adoc[CConnman]::GetAddresses
:relfileprefix: ../
:mrdocs:

Return addresses from the per&hyphen;requestor cache&period; If no cache entry exists, it is populated with randomly selected addresses&period; This function can be used in untrusted contexts&period;

== Synopsis

Declared in `&lt;net&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
std::vector&lt;CAddress&gt;
GetAddresses(
    xref:CNode.adoc[CNode]& requestor,
    size&lowbar;t max&lowbar;addresses,
    size&lowbar;t max&lowbar;pct);
----

== Description

A trusted caller (e&period;g&period; from RPC or a peer with addr permission) can use xref:CConnman/GetAddressesUnsafe.adoc[`GetAddressesUnsafe`] to avoid using the cache&period;

== Return Value

the cached (or freshly cached) addresses for this requestor&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *requestor* [in]
| The requesting peer&period; Used to key the cache to prevent privacy leaks&period;
| *max&lowbar;addresses* [in]
| Maximum number of addresses to return (0 &equals; all)&period; Ignored when cache already contains an entry for requestor&period;
| *max&lowbar;pct* [in]
| Maximum percentage of addresses to return (0 &equals; all)&period; Value must be from 0 to 100&period; Ignored when cache already contains an entry for requestor&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
