mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
addrman: add functionality to select by network
Add an optional parameter to the addrman Select function that allows callers to specify which network the returned address should be on. Ensure that the proper table is selected with different cases of whether the new or tried table has network addresses that match. Co-authored-by: Martin Zumsande <mzumsande@gmail.com>
This commit is contained in:
@@ -146,11 +146,12 @@ public:
|
||||
/**
|
||||
* Choose an address to connect to.
|
||||
*
|
||||
* @param[in] new_only Whether to only select addresses from the new table.
|
||||
* @param[in] new_only Whether to only select addresses from the new table.
|
||||
* @param[in] network Select only addresses of this network (nullopt = all)
|
||||
* @return CAddress The record for the selected peer.
|
||||
* seconds The last time we attempted to connect to that peer.
|
||||
*/
|
||||
std::pair<CAddress, NodeSeconds> Select(bool new_only = false) const;
|
||||
std::pair<CAddress, NodeSeconds> Select(bool new_only = false, std::optional<Network> network = std::nullopt) const;
|
||||
|
||||
/**
|
||||
* Return all or many randomly selected addresses, optionally by network.
|
||||
|
||||
Reference in New Issue
Block a user