addrman: add function to return size by network and table

For now, the new functionality will be used in the context of
querying fixed seeds. Other possible applications for
future changes is the use in the context of making automatic
connections to specific networks, or making more detailed info
about addrman accessible via rpc.
This commit is contained in:
Martin Zumsande
2022-11-29 17:16:26 -05:00
parent adc41cf3b2
commit d35595a78a
4 changed files with 117 additions and 0 deletions

View File

@@ -102,6 +102,15 @@ public:
//! Return the number of (unique) addresses in all tables.
size_t size() const;
/**
* Return size information about addrman.
*
* @param[in] net Select addresses only from specified network (nullopt = all)
* @param[in] in_new Select addresses only from one table (true = new, false = tried, nullopt = both)
* @return Number of unique addresses that match specified options.
*/
size_t Size(std::optional<Network> net, std::optional<bool> in_new) const;
/**
* Attempt to add one or more addresses to addrman's new table.
*