55 std::vector<unsigned char> vchSourceGroupKey = netgroupman.
GetGroup(src);
73 if (
nTime > now + 10min) {
102 fChance *= pow(0.66, std::min(
nAttempts, 8));
108 : insecure_rand{deterministic}
109 , nKey{deterministic ?
uint256{1} : insecure_rand.rand256()}
110 , m_consistency_check_ratio{consistency_check_ratio}
111 , m_netgroupman{netgroupman}
113 for (
auto& bucket : vvNew) {
114 for (
auto& entry : bucket) {
118 for (
auto& bucket : vvTried) {
119 for (
auto& entry : bucket) {
130 template <
typename Stream>
181 static constexpr uint8_t lowest_compatible = Format::V4_MULTIPORT;
190 std::unordered_map<int, int> mapUnkIds;
192 for (
const auto& entry : mapInfo) {
193 mapUnkIds[entry.first] = nIds;
194 const AddrInfo& info = entry.second;
202 for (
const auto& entry : mapInfo) {
203 const AddrInfo& info = entry.second;
213 if (vvNew[bucket][i] != -1)
218 if (vvNew[bucket][i] != -1) {
219 int nIndex = mapUnkIds[vvNew[bucket][i]];
229 template <
typename Stream>
237 s_ >> Using<CustomUintFormatter<1>>(
format);
239 int stream_version = s_.GetVersion();
240 if (
format >= Format::V3_BIP155) {
252 "Corrupted addrman database: The compat value (%u) "
253 "is lower than the expected minimum value %u.",
259 "Unsupported format of addrman database: %u. It is compatible with formats >=%u, "
260 "but the maximum supported by this version of %s is %u.",
269 if (
format >= Format::V1_DETERMINISTIC) {
270 nUBuckets ^= (1 << 30);
274 throw std::ios_base::failure(
275 strprintf(
"Corrupt AddrMan serialization: nNew=%d, should be in [0, %d]",
281 throw std::ios_base::failure(
282 strprintf(
"Corrupt AddrMan serialization: nTried=%d, should be in [0, %d]",
288 for (
int n = 0; n < nNew; n++) {
293 vRandom.push_back(n);
300 for (
int n = 0; n < nTried; n++) {
306 && vvTried[nKBucket][nKBucketPos] == -1) {
309 vRandom.push_back(nIdCount);
310 mapInfo[nIdCount] = info;
311 mapAddr[info] = nIdCount;
312 vvTried[nKBucket][nKBucketPos] = nIdCount;
314 m_network_counts[info.
GetNetwork()].n_tried++;
324 std::vector<std::pair<int, int>> bucket_entries;
326 for (
int bucket = 0; bucket < nUBuckets; ++bucket) {
329 for (
int n = 0; n < num_entries; ++n) {
332 if (entry_index >= 0 && entry_index < nNew) {
333 bucket_entries.emplace_back(bucket, entry_index);
342 uint256 serialized_asmap_checksum;
343 if (
format >= Format::V2_ASMAP) {
344 s >> serialized_asmap_checksum;
347 serialized_asmap_checksum == supplied_asmap_checksum};
349 if (!restore_bucketing) {
353 for (
auto bucket_entry : bucket_entries) {
354 int bucket{bucket_entry.first};
355 const int entry_index{bucket_entry.second};
356 AddrInfo& info = mapInfo[entry_index];
367 if (restore_bucketing && vvNew[bucket][bucket_position] == -1) {
369 vvNew[bucket][bucket_position] = entry_index;
376 if (vvNew[bucket][bucket_position] == -1) {
377 vvNew[bucket][bucket_position] = entry_index;
385 for (
auto it = mapInfo.cbegin(); it != mapInfo.cend(); ) {
386 if (it->second.fInTried ==
false && it->second.nRefCount == 0) {
387 const auto itCopy = it++;
394 if (nLost + nLostUnk > 0) {
395 LogPrint(
BCLog::ADDRMAN,
"addrman lost %i new and %i tried addresses due to collisions or invalid addresses\n", nLostUnk, nLost);
399 if (check_code != 0) {
401 "Corrupt data. Consistency check failed with code %s",
410 const auto it = mapAddr.find(addr);
411 if (it == mapAddr.end())
414 *pnId = (*it).second;
415 const auto it2 = mapInfo.find((*it).second);
416 if (it2 != mapInfo.end())
417 return &(*it2).second;
425 int nId = nIdCount++;
426 mapInfo[nId] =
AddrInfo(addr, addrSource);
428 mapInfo[nId].nRandomPos = vRandom.size();
429 vRandom.push_back(nId);
434 return &mapInfo[nId];
441 if (nRndPos1 == nRndPos2)
444 assert(nRndPos1 < vRandom.size() && nRndPos2 < vRandom.size());
446 int nId1 = vRandom[nRndPos1];
447 int nId2 = vRandom[nRndPos2];
449 const auto it_1{mapInfo.find(nId1)};
450 const auto it_2{mapInfo.find(nId2)};
451 assert(it_1 != mapInfo.end());
452 assert(it_2 != mapInfo.end());
454 it_1->second.nRandomPos = nRndPos2;
455 it_2->second.nRandomPos = nRndPos1;
457 vRandom[nRndPos1] = nId2;
458 vRandom[nRndPos2] = nId1;
465 assert(mapInfo.count(nId) != 0);
483 if (vvNew[nUBucket][nUBucketPos] != -1) {
484 int nIdDelete = vvNew[nUBucket][nUBucketPos];
485 AddrInfo& infoDelete = mapInfo[nIdDelete];
488 vvNew[nUBucket][nUBucketPos] = -1;
505 if (vvNew[bucket][pos] == nId) {
506 vvNew[bucket][pos] = -1;
521 if (vvTried[nKBucket][nKBucketPos] != -1) {
523 int nIdEvict = vvTried[nKBucket][nKBucketPos];
524 assert(mapInfo.count(nIdEvict) == 1);
525 AddrInfo& infoOld = mapInfo[nIdEvict];
529 vvTried[nKBucket][nKBucketPos] = -1;
531 m_network_counts[infoOld.
GetNetwork()].n_tried--;
537 assert(vvNew[nUBucket][nUBucketPos] == -1);
541 vvNew[nUBucket][nUBucketPos] = nIdEvict;
543 m_network_counts[infoOld.
GetNetwork()].n_new++;
547 assert(vvTried[nKBucket][nKBucketPos] == -1);
549 vvTried[nKBucket][nKBucketPos] = nId;
552 m_network_counts[info.
GetNetwork()].n_tried++;
573 const auto update_interval{currently_online ? 1h : 24h};
574 if (pinfo->
nTime < addr.
nTime - update_interval - time_penalty) {
596 for (
int n = 0; n < pinfo->
nRefCount; n++)
598 if (nFactor > 1 && (insecure_rand.randrange(nFactor) != 0))
607 bool fInsert = vvNew[nUBucket][nUBucketPos] == -1;
608 if (vvNew[nUBucket][nUBucketPos] != nId) {
610 AddrInfo& infoExisting = mapInfo[vvNew[nUBucket][nUBucketPos]];
619 vvNew[nUBucket][nUBucketPos] = nId;
642 if (!pinfo)
return false;
665 if (test_before_evict && (vvTried[tried_bucket][tried_bucket_pos] != -1)) {
670 auto colliding_entry = mapInfo.find(vvTried[tried_bucket][tried_bucket_pos]);
672 colliding_entry != mapInfo.end() ? colliding_entry->second.ToStringAddrPort() :
"",
688 for (std::vector<CAddress>::const_iterator it = vAddr.begin(); it != vAddr.end(); it++) {
692 LogPrint(
BCLog::ADDRMAN,
"Added %i addresses (of %i) from %s: %i tried, %i new\n", added, vAddr.size(),
source.ToStringAddr(), nTried, nNew);
721 if (vRandom.empty())
return {};
723 if (newOnly && nNew == 0)
return {};
727 (nTried > 0 && (nNew == 0 || insecure_rand.randbool() == 0))) {
729 double fChanceFactor = 1.0;
744 const auto it_found{mapInfo.find(nId)};
745 assert(it_found != mapInfo.end());
746 const AddrInfo& info{it_found->second};
748 if (insecure_rand.randbits(30) < fChanceFactor * info.GetChance() * (1 << 30)) {
750 return {info, info.m_last_try};
753 fChanceFactor *= 1.2;
757 double fChanceFactor = 1.0;
772 const auto it_found{mapInfo.find(nId)};
773 assert(it_found != mapInfo.end());
774 const AddrInfo& info{it_found->second};
776 if (insecure_rand.randbits(30) < fChanceFactor * info.GetChance() * (1 << 30)) {
778 return {info, info.m_last_try};
781 fChanceFactor *= 1.2;
786 std::vector<CAddress>
AddrManImpl::GetAddr_(
size_t max_addresses,
size_t max_pct, std::optional<Network> network)
const
790 size_t nNodes = vRandom.size();
792 nNodes = max_pct * nNodes / 100;
794 if (max_addresses != 0) {
795 nNodes = std::min(nNodes, max_addresses);
799 const auto now{Now<NodeSeconds>()};
800 std::vector<CAddress> addresses;
801 for (
unsigned int n = 0; n < vRandom.size(); n++) {
802 if (addresses.size() >= nNodes)
805 int nRndPos = insecure_rand.randrange(vRandom.size() - n) + n;
807 const auto it{mapInfo.find(vRandom[n])};
808 assert(it != mapInfo.end());
813 if (network != std::nullopt && ai.GetNetClass() != network)
continue;
816 if (ai.IsTerrible(now))
continue;
818 addresses.push_back(ai);
837 const auto update_interval{20min};
838 if (time - info.
nTime > update_interval) {
866 bool erase_collision =
false;
869 if (mapInfo.count(id_new) != 1) {
870 erase_collision =
true;
872 AddrInfo& info_new = mapInfo[id_new];
878 erase_collision =
true;
879 }
else if (vvTried[tried_bucket][tried_bucket_pos] != -1) {
882 int id_old = vvTried[tried_bucket][tried_bucket_pos];
883 AddrInfo& info_old = mapInfo[id_old];
885 const auto current_time{Now<NodeSeconds>()};
889 erase_collision =
true;
893 if (current_time - info_old.
m_last_try > 60s) {
897 Good_(info_new,
false, current_time);
898 erase_collision =
true;
905 Good_(info_new,
false, current_time);
906 erase_collision =
true;
909 Good_(info_new,
false, Now<NodeSeconds>());
910 erase_collision =
true;
914 if (erase_collision) {
935 if (mapInfo.count(id_new) != 1) {
940 const AddrInfo& newInfo = mapInfo[id_new];
946 const AddrInfo& info_old = mapInfo[vvTried[tried_bucket][tried_bucket_pos]];
956 if (!addr_info)
return std::nullopt;
977 if (!net.has_value()) {
978 if (in_new.has_value()) {
979 return *in_new ? nNew : nTried;
981 return vRandom.size();
984 if (
auto it = m_network_counts.find(*net); it != m_network_counts.end()) {
985 auto net_count = it->second;
986 if (in_new.has_value()) {
987 return *in_new ? net_count.n_new : net_count.n_tried;
989 return net_count.n_new + net_count.n_tried;
1005 LogPrintf(
"ADDRMAN CONSISTENCY CHECK FAILED!!! err=%i\n", err);
1017 std::unordered_set<int> setTried;
1018 std::unordered_map<int, int> mapNew;
1019 std::unordered_map<Network, NewTriedCount> local_counts;
1021 if (vRandom.size() != (
size_t)(nTried + nNew))
1024 for (
const auto& entry : mapInfo) {
1025 int n = entry.first;
1026 const AddrInfo& info = entry.second;
1028 if (!TicksSinceEpoch<std::chrono::seconds>(info.
m_last_success)) {
1043 const auto it{mapAddr.find(info)};
1044 if (it == mapAddr.end() || it->second != n) {
1057 if (setTried.size() != (
size_t)nTried)
1059 if (mapNew.size() != (
size_t)nNew)
1064 if (vvTried[n][i] != -1) {
1065 if (!setTried.count(vvTried[n][i]))
1067 const auto it{mapInfo.find(vvTried[n][i])};
1068 if (it == mapInfo.end() || it->second.GetTriedBucket(
nKey,
m_netgroupman) != n) {
1071 if (it->second.GetBucketPosition(
nKey,
false, n) != i) {
1074 setTried.erase(vvTried[n][i]);
1081 if (vvNew[n][i] != -1) {
1082 if (!mapNew.count(vvNew[n][i]))
1084 const auto it{mapInfo.find(vvNew[n][i])};
1085 if (it == mapInfo.end() || it->second.GetBucketPosition(
nKey,
true, n) != i) {
1088 if (--mapNew[vvNew[n][i]] == 0)
1089 mapNew.erase(vvNew[n][i]);
1094 if (setTried.size())
1103 if (m_network_counts.size() < local_counts.size()) {
1106 for (
const auto& [net,
count] : m_network_counts) {
1107 if (local_counts[net].n_new !=
count.n_new || local_counts[net].n_tried !=
count.n_tried) {
1137 auto ret =
Good_(addr,
true, time);
1146 Attempt_(addr, fCountFailure, time);
1171 auto addrRet =
Select_(newOnly);
1176 std::vector<CAddress>
AddrManImpl::GetAddr(
size_t max_addresses,
size_t max_pct, std::optional<Network> network)
const
1180 auto addresses =
GetAddr_(max_addresses, max_pct, network);
1211 : m_impl(
std::make_unique<
AddrManImpl>(netgroupman, deterministic, consistency_check_ratio)) {}
1215 template <
typename Stream>
1218 m_impl->Serialize<Stream>(s_);
1221 template <
typename Stream>
1224 m_impl->Unserialize<Stream>(s_);
1235 size_t AddrMan::Size(std::optional<Network> net, std::optional<bool> in_new)
const
1237 return m_impl->Size(net, in_new);
1247 return m_impl->Good(addr, time);
1252 m_impl->Attempt(addr, fCountFailure, time);
1257 m_impl->ResolveCollisions();
1262 return m_impl->SelectTriedCollision();
1267 return m_impl->Select(newOnly);
1270 std::vector<CAddress>
AddrMan::GetAddr(
size_t max_addresses,
size_t max_pct, std::optional<Network> network)
const
1272 return m_impl->GetAddr(max_addresses, max_pct, network);
1277 m_impl->Connected(addr, time);
1282 m_impl->SetServices(addr, nServices);
1287 return m_impl->FindAddressEntry(addr);
static constexpr uint32_t ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP
Over how many buckets entries with new addresses originating from a single group are spread.
static constexpr auto ADDRMAN_HORIZON
How old addresses can maximally be.
static constexpr int32_t ADDRMAN_MAX_FAILURES
How many successive failures are allowed ...
static constexpr auto ADDRMAN_MIN_FAIL
...
static constexpr auto ADDRMAN_TEST_WINDOW
The maximum time we'll spend trying to resolve a tried table collision.
static constexpr auto ADDRMAN_REPLACEMENT
How recent a successful connection should be before we allow an address to be evicted from tried.
static constexpr int32_t ADDRMAN_RETRIES
After how many failed attempts we give up on a new node.
static constexpr size_t ADDRMAN_SET_TRIED_COLLISION_SIZE
The maximum number of tried addr collisions to store.
static constexpr uint32_t ADDRMAN_TRIED_BUCKETS_PER_GROUP
Over how many buckets entries with tried addresses from a single group (/16 for IPv4) are spread.
static constexpr int32_t ADDRMAN_NEW_BUCKETS_PER_ADDRESS
Maximum number of times an address can occur in the new table.
static constexpr int ADDRMAN_TRIED_BUCKET_COUNT
static constexpr int ADDRMAN_BUCKET_SIZE
static constexpr int ADDRMAN_NEW_BUCKET_COUNT
#define Assume(val)
Assume is the identity function.
Extended statistics about a CAddress.
int GetNewBucket(const uint256 &nKey, const CNetAddr &src, const NetGroupManager &netgroupman) const
Calculate in which "new" bucket this entry belongs, given a certain source.
int GetTriedBucket(const uint256 &nKey, const NetGroupManager &netgroupman) const
Calculate in which "tried" bucket this entry belongs.
int nRandomPos
position in vRandom
bool fInTried
in tried set? (memory only)
NodeSeconds m_last_success
last successful connection by us
NodeSeconds m_last_count_attempt
last counted attempt (memory only)
NodeSeconds m_last_try
last try whatsoever by us (memory only)
double GetChance(NodeSeconds now=Now< NodeSeconds >()) const
Calculate the relative chance this entry should be given when selecting nodes to connect to.
bool IsTerrible(NodeSeconds now=Now< NodeSeconds >()) const
Determine whether the statistics about this entry are bad enough so that it can just be deleted.
int nRefCount
reference count in new sets (memory only)
int GetBucketPosition(const uint256 &nKey, bool fNew, int nBucket) const
Calculate in which position of a bucket to store this entry.
int nAttempts
connection attempts since last successful attempt
void Connected(const CService &addr, NodeSeconds time=Now< NodeSeconds >())
We have successfully connected to this peer.
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.
void Attempt(const CService &addr, bool fCountFailure, NodeSeconds time=Now< NodeSeconds >())
Mark an entry as connection attempted to.
size_t Size(std::optional< Network > net=std::nullopt, std::optional< bool > in_new=std::nullopt) const
Return size information about addrman.
std::optional< AddressPosition > FindAddressEntry(const CAddress &addr)
Test-only function Find the address record in AddrMan and return information about its position.
std::pair< CAddress, NodeSeconds > Select(bool newOnly=false) const
Choose an address to connect to.
void ResolveCollisions()
See if any to-be-evicted tried table entries have been tested and if so resolve the collisions.
bool Good(const CService &addr, NodeSeconds time=Now< NodeSeconds >())
Mark an address record as accessible and attempt to move it to addrman's tried table.
void Serialize(Stream &s_) const
void Unserialize(Stream &s_)
AddrMan(const NetGroupManager &netgroupman, bool deterministic, int32_t consistency_check_ratio)
std::pair< CAddress, NodeSeconds > SelectTriedCollision()
Randomly select an address in the tried table that another address is attempting to evict.
bool Add(const std::vector< CAddress > &vAddr, const CNetAddr &source, std::chrono::seconds time_penalty=0s)
Attempt to add one or more addresses to addrman's new table.
void SetServices(const CService &addr, ServiceFlags nServices)
Update an entry's service bits.
void ClearNew(int nUBucket, int nUBucketPos) EXCLUSIVE_LOCKS_REQUIRED(cs)
Clear a position in a "new" table. This is the only place where entries are actually deleted.
std::pair< CAddress, NodeSeconds > Select(bool newOnly) const EXCLUSIVE_LOCKS_REQUIRED(!cs)
void Connected_(const CService &addr, NodeSeconds time) EXCLUSIVE_LOCKS_REQUIRED(cs)
void Attempt_(const CService &addr, bool fCountFailure, NodeSeconds time) EXCLUSIVE_LOCKS_REQUIRED(cs)
static constexpr Format FILE_FORMAT
The maximum format this software knows it can unserialize.
void ResolveCollisions_() EXCLUSIVE_LOCKS_REQUIRED(cs)
Format
Serialization versions.
void Serialize(Stream &s_) const EXCLUSIVE_LOCKS_REQUIRED(!cs)
void Connected(const CService &addr, NodeSeconds time) EXCLUSIVE_LOCKS_REQUIRED(!cs)
std::vector< CAddress > GetAddr(size_t max_addresses, size_t max_pct, std::optional< Network > network) const EXCLUSIVE_LOCKS_REQUIRED(!cs)
void MakeTried(AddrInfo &info, int nId) EXCLUSIVE_LOCKS_REQUIRED(cs)
Move an entry from the "new" table(s) to the "tried" table.
void SetServices(const CService &addr, ServiceFlags nServices) EXCLUSIVE_LOCKS_REQUIRED(!cs)
std::optional< AddressPosition > FindAddressEntry_(const CAddress &addr) EXCLUSIVE_LOCKS_REQUIRED(cs)
void SetServices_(const CService &addr, ServiceFlags nServices) EXCLUSIVE_LOCKS_REQUIRED(cs)
AddrManImpl(const NetGroupManager &netgroupman, bool deterministic, int32_t consistency_check_ratio)
const int32_t m_consistency_check_ratio
Perform consistency checks every m_consistency_check_ratio operations (if non-zero).
void Check() const EXCLUSIVE_LOCKS_REQUIRED(cs)
Consistency check, taking into account m_consistency_check_ratio.
int CheckAddrman() const EXCLUSIVE_LOCKS_REQUIRED(cs)
Perform consistency check, regardless of m_consistency_check_ratio.
bool Add(const std::vector< CAddress > &vAddr, const CNetAddr &source, std::chrono::seconds time_penalty) EXCLUSIVE_LOCKS_REQUIRED(!cs)
std::optional< AddressPosition > FindAddressEntry(const CAddress &addr) EXCLUSIVE_LOCKS_REQUIRED(!cs)
AddrInfo * Find(const CService &addr, int *pnId=nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs)
Find an entry.
bool Good_(const CService &addr, bool test_before_evict, NodeSeconds time) EXCLUSIVE_LOCKS_REQUIRED(cs)
Mutex cs
A mutex to protect the inner data structures.
size_t Size_(std::optional< Network > net, std::optional< bool > in_new) const EXCLUSIVE_LOCKS_REQUIRED(cs)
std::pair< CAddress, NodeSeconds > SelectTriedCollision_() EXCLUSIVE_LOCKS_REQUIRED(cs)
std::pair< CAddress, NodeSeconds > Select_(bool newOnly) const EXCLUSIVE_LOCKS_REQUIRED(cs)
std::pair< CAddress, NodeSeconds > SelectTriedCollision() EXCLUSIVE_LOCKS_REQUIRED(!cs)
static constexpr uint8_t INCOMPATIBILITY_BASE
The initial value of a field that is incremented every time an incompatible format change is made (su...
void Delete(int nId) EXCLUSIVE_LOCKS_REQUIRED(cs)
Delete an entry. It must not be in tried, and have refcount 0.
void SwapRandom(unsigned int nRandomPos1, unsigned int nRandomPos2) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Swap two elements in vRandom.
void Attempt(const CService &addr, bool fCountFailure, NodeSeconds time) EXCLUSIVE_LOCKS_REQUIRED(!cs)
void Unserialize(Stream &s_) EXCLUSIVE_LOCKS_REQUIRED(!cs)
std::set< int > m_tried_collisions
Holds addrs inserted into tried table that collide with existing entries. Test-before-evict disciplin...
uint256 nKey
secret key to randomize bucket select with
void ResolveCollisions() EXCLUSIVE_LOCKS_REQUIRED(!cs)
AddrInfo * Create(const CAddress &addr, const CNetAddr &addrSource, int *pnId=nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs)
Create a new entry and add it to the internal data structures mapInfo, mapAddr and vRandom.
const NetGroupManager & m_netgroupman
Reference to the netgroup manager.
std::vector< CAddress > GetAddr_(size_t max_addresses, size_t max_pct, std::optional< Network > network) const EXCLUSIVE_LOCKS_REQUIRED(cs)
bool Add_(const std::vector< CAddress > &vAddr, const CNetAddr &source, std::chrono::seconds time_penalty) EXCLUSIVE_LOCKS_REQUIRED(cs)
bool Good(const CService &addr, NodeSeconds time) EXCLUSIVE_LOCKS_REQUIRED(!cs)
size_t Size(std::optional< Network > net, std::optional< bool > in_new) const EXCLUSIVE_LOCKS_REQUIRED(!cs)
bool AddSingle(const CAddress &addr, const CNetAddr &source, std::chrono::seconds time_penalty) EXCLUSIVE_LOCKS_REQUIRED(cs)
Attempt to add a single address to addrman's new table.
A CService with information about it as peer.
ServiceFlags nServices
Serialized as uint64_t in V1, and as CompactSize in V2.
NodeSeconds nTime
Always included in serialization. The behavior is unspecified if the value is not representable as ui...
enum Network GetNetwork() const
A combination of a network address (CNetAddr) and a (TCP) port.
std::string ToStringAddrPort() const
std::vector< unsigned char > GetKey() const
Writes data to an underlying source stream, while hashing the written data.
uint256 GetAsmapChecksum() const
Get a checksum identifying the asmap being used.
std::vector< unsigned char > GetGroup(const CNetAddr &address) const
Get the canonical identifier of the network group for address.
uint32_t GetMappedAS(const CNetAddr &address) const
Get the autonomous system on the BGP path to address.
constexpr bool IsNull() const
#define LogPrint(category,...)
static constexpr int ADDRV2_FORMAT
A flag that is ORed into the protocol version to designate that addresses should be serialized in (un...
ServiceFlags
nServices flags
Test-only struct, capturing info about an address in AddrMan.
static time_point now() noexcept
Return current system time or mocked time, if set.
std::chrono::time_point< NodeClock, std::chrono::seconds > NodeSeconds
#define LOG_TIME_MILLIS_WITH_CATEGORY_MSG_ONCE(end_msg, log_category)