6#ifndef BITCOIN_ADDRMAN_H
7#define BITCOIN_ADDRMAN_H
56 const std::unique_ptr<AddrManImpl>
m_impl;
59 explicit AddrMan(std::vector<bool> asmap,
bool deterministic, int32_t consistency_check_ratio);
63 template <
typename Stream>
66 template <
typename Stream>
81 bool Add(
const std::vector<CAddress>& vAddr,
const CNetAddr&
source, int64_t nTimePenalty = 0);
108 std::pair<CAddress, int64_t>
Select(
bool newOnly =
false)
const;
119 std::vector<CAddress>
GetAddr(
size_t max_addresses,
size_t max_pct, std::optional<Network> network)
const;
137 const std::vector<bool>&
GetAsmap()
const;
static constexpr int32_t DEFAULT_ADDRMAN_CONSISTENCY_CHECKS
Default for -checkaddrman.
Stochastic address manager.
std::pair< CAddress, int64_t > SelectTriedCollision()
Randomly select an address in the tried table that another address is attempting to evict.
const std::unique_ptr< AddrManImpl > m_impl
std::vector< CAddress > GetAddr(size_t max_addresses, size_t max_pct, std::optional< Network > network) const
Return all or many randomly selected addresses, optionally by network.
const std::vector< bool > & GetAsmap() const
bool Add(const std::vector< CAddress > &vAddr, const CNetAddr &source, int64_t nTimePenalty=0)
Attempt to add one or more addresses to addrman's new table.
void Good(const CService &addr, int64_t nTime=GetAdjustedTime())
Mark an entry as accessible, possibly moving it from "new" to "tried".
void ResolveCollisions()
See if any to-be-evicted tried table entries have been tested and if so resolve the collisions.
void Connected(const CService &addr, int64_t nTime=GetAdjustedTime())
We have successfully connected to this peer.
void Attempt(const CService &addr, bool fCountFailure, int64_t nTime=GetAdjustedTime())
Mark an entry as connection attempted to.
void Serialize(Stream &s_) const
size_t size() const
Return the number of (unique) addresses in all tables.
void Unserialize(Stream &s_)
AddrMan(std::vector< bool > asmap, bool deterministic, int32_t consistency_check_ratio)
std::pair< CAddress, int64_t > Select(bool newOnly=false) const
Choose an address to connect to.
void SetServices(const CService &addr, ServiceFlags nServices)
Update an entry's service bits.
A combination of a network address (CNetAddr) and a (TCP) port.
ServiceFlags
nServices flags
int64_t GetAdjustedTime()