diff options
author | Jon Atack <jon@atack.com> | 2021-05-02 18:44:17 +0200 |
---|---|---|
committer | Jon Atack <jon@atack.com> | 2021-05-19 13:04:07 +0200 |
commit | d35ddca91ebbcf8d8b790c3b9f8cf218fafb7a53 (patch) | |
tree | 5264e3a68bbffed7b708b9c513bb91d6a31d53f9 /src/addrman.h | |
parent | 4da26fb85d6d6d205a2794ccb98beee1302b4a25 (diff) | |
download | bitcoin-d35ddca91ebbcf8d8b790c3b9f8cf218fafb7a53.tar.xz |
p2p: enable CAddrMan::GetAddr_() by network, add doxygen
Diffstat (limited to 'src/addrman.h')
-rw-r--r-- | src/addrman.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/addrman.h b/src/addrman.h index 92a5570953..cf059478a5 100644 --- a/src/addrman.h +++ b/src/addrman.h @@ -20,6 +20,7 @@ #include <hash.h> #include <iostream> #include <map> +#include <optional> #include <set> #include <stdint.h> #include <streams.h> @@ -278,8 +279,15 @@ protected: int Check_() EXCLUSIVE_LOCKS_REQUIRED(cs); #endif - //! Select several addresses at once. - void GetAddr_(std::vector<CAddress> &vAddr, size_t max_addresses, size_t max_pct) EXCLUSIVE_LOCKS_REQUIRED(cs); + /** + * Return all or many randomly selected addresses, optionally by network. + * + * @param[out] vAddr Vector of randomly selected addresses from vRandom. + * @param[in] max_addresses Maximum number of addresses to return (0 = all). + * @param[in] max_pct Maximum percentage of addresses to return (0 = all). + * @param[in] network Select only addresses of this network (nullopt = all). + */ + void GetAddr_(std::vector<CAddress>& vAddr, size_t max_addresses, size_t max_pct, std::optional<Network> network = std::nullopt) EXCLUSIVE_LOCKS_REQUIRED(cs); /** We have successfully connected to this peer. Calling this function * updates the CAddress's nTime, which is used in our IsTerrible() |