From a49f3ddbbabfb971a537f0a6c7affb24e20ff192 Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Sun, 2 May 2021 19:03:49 +0200 Subject: p2p: allow CAddrMan::GetAddr() by network, add doxygen --- src/addrman.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/addrman.h') diff --git a/src/addrman.h b/src/addrman.h index cf059478a5..eaedfd318c 100644 --- a/src/addrman.h +++ b/src/addrman.h @@ -287,7 +287,7 @@ protected: * @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& vAddr, size_t max_addresses, size_t max_pct, std::optional network = std::nullopt) EXCLUSIVE_LOCKS_REQUIRED(cs); + void GetAddr_(std::vector& vAddr, size_t max_addresses, size_t max_pct, std::optional network) 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() @@ -723,14 +723,20 @@ public: return addrRet; } - //! Return a bunch of addresses, selected at random. - std::vector GetAddr(size_t max_addresses, size_t max_pct) + /** + * Return all or many randomly selected addresses, optionally by network. + * + * @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). + */ + std::vector GetAddr(size_t max_addresses, size_t max_pct, std::optional network) { Check(); std::vector vAddr; { LOCK(cs); - GetAddr_(vAddr, max_addresses, max_pct); + GetAddr_(vAddr, max_addresses, max_pct, network); } Check(); return vAddr; -- cgit v1.2.3