|
| AddrManImpl (std::vector< bool > &&asmap, int32_t consistency_check_ratio) |
|
| ~AddrManImpl () |
|
template<typename Stream > |
void | Serialize (Stream &s_) const EXCLUSIVE_LOCKS_REQUIRED(!cs) |
|
template<typename Stream > |
void | Unserialize (Stream &s_) EXCLUSIVE_LOCKS_REQUIRED(!cs) |
|
size_t | size () const EXCLUSIVE_LOCKS_REQUIRED(!cs) |
|
bool | Add (const std::vector< CAddress > &vAddr, const CNetAddr &source, std::chrono::seconds time_penalty) EXCLUSIVE_LOCKS_REQUIRED(!cs) |
|
void | Good (const CService &addr, bool test_before_evict, NodeSeconds time) EXCLUSIVE_LOCKS_REQUIRED(!cs) |
|
void | Attempt (const CService &addr, bool fCountFailure, NodeSeconds time) EXCLUSIVE_LOCKS_REQUIRED(!cs) |
|
void | ResolveCollisions () 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::vector< CAddress > | GetAddr (size_t max_addresses, size_t max_pct, std::optional< Network > network) const EXCLUSIVE_LOCKS_REQUIRED(!cs) |
|
void | Connected (const CService &addr, NodeSeconds time) EXCLUSIVE_LOCKS_REQUIRED(!cs) |
|
void | SetServices (const CService &addr, ServiceFlags nServices) EXCLUSIVE_LOCKS_REQUIRED(!cs) |
|
const std::vector< bool > & | GetAsmap () const |
|
void | Clear () EXCLUSIVE_LOCKS_REQUIRED(!cs) |
|
void | MakeDeterministic () EXCLUSIVE_LOCKS_REQUIRED(!cs) |
|
|
int nIdCount | GUARDED_BY (cs) |
| last used nId More...
|
|
std::unordered_map< int, AddrInfo > mapInfo | GUARDED_BY (cs) |
| table with information about all nIds More...
|
|
std::unordered_map< CService, int, CServiceHash > mapAddr | GUARDED_BY (cs) |
| find an nId based on its network address and port. More...
|
|
std::vector< int > vRandom | GUARDED_BY (cs) |
| randomly-ordered vector of all nIds This is mutable because it is unobservable outside the class, so any changes to it (even in const methods) are also unobservable. More...
|
|
int nTried | GUARDED_BY (cs) |
|
int vvTried[ADDRMAN_TRIED_BUCKET_COUNT][ADDRMAN_BUCKET_SIZE] | GUARDED_BY (cs) |
| list of "tried" buckets More...
|
|
int nNew | GUARDED_BY (cs) |
| number of (unique) "new" entries More...
|
|
int vvNew[ADDRMAN_NEW_BUCKET_COUNT][ADDRMAN_BUCKET_SIZE] | GUARDED_BY (cs) |
| list of "new" buckets More...
|
|
NodeSeconds m_last_good | GUARDED_BY (cs) |
| last time Good was called (memory only) More...
|
|
AddrInfo * | Find (const CService &addr, int *pnId=nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs) |
| Find an entry. More...
|
|
AddrInfo * | Create (const CAddress &addr, const CNetAddr &addrSource, int *pnId=nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs) |
| find an entry, creating it if necessary. More...
|
|
void | SwapRandom (unsigned int nRandomPos1, unsigned int nRandomPos2) const EXCLUSIVE_LOCKS_REQUIRED(cs) |
| Swap two elements in vRandom. More...
|
|
void | Delete (int nId) EXCLUSIVE_LOCKS_REQUIRED(cs) |
| Delete an entry. It must not be in tried, and have refcount 0. More...
|
|
void | ClearNew (int nUBucket, int nUBucketPos) EXCLUSIVE_LOCKS_REQUIRED(cs) |
| Clear a position in a "new" table. More...
|
|
void | MakeTried (AddrInfo &info, int nId) EXCLUSIVE_LOCKS_REQUIRED(cs) |
| Move an entry from the "new" table(s) to the "tried" table. More...
|
|
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. More...
|
|
void | Good_ (const CService &addr, bool test_before_evict, NodeSeconds time) EXCLUSIVE_LOCKS_REQUIRED(cs) |
|
bool | Add_ (const std::vector< CAddress > &vAddr, const CNetAddr &source, std::chrono::seconds time_penalty) EXCLUSIVE_LOCKS_REQUIRED(cs) |
|
void | Attempt_ (const CService &addr, bool fCountFailure, NodeSeconds time) EXCLUSIVE_LOCKS_REQUIRED(cs) |
|
std::pair< CAddress, NodeSeconds > | Select_ (bool newOnly) const 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 | Connected_ (const CService &addr, NodeSeconds time) EXCLUSIVE_LOCKS_REQUIRED(cs) |
|
void | SetServices_ (const CService &addr, ServiceFlags nServices) EXCLUSIVE_LOCKS_REQUIRED(cs) |
|
void | ResolveCollisions_ () EXCLUSIVE_LOCKS_REQUIRED(cs) |
|
std::pair< CAddress, NodeSeconds > | SelectTriedCollision_ () EXCLUSIVE_LOCKS_REQUIRED(cs) |
|
void | Check () const EXCLUSIVE_LOCKS_REQUIRED(cs) |
| Consistency check, taking into account m_consistency_check_ratio. More...
|
|
int | CheckAddrman () const EXCLUSIVE_LOCKS_REQUIRED(cs) |
| Perform consistency check, regardless of m_consistency_check_ratio. More...
|
|
Definition at line 109 of file addrman_impl.h.
template<typename Stream >
void AddrManImpl::Serialize |
( |
Stream & |
s_ | ) |
const |
Serialized format.
- format version byte (
- See also
Format
)
- lowest compatible format version byte. This is used to help old software decide whether to parse the file. For example:
- Bitcoin ABC version N knows how to parse up to format=3. If a new format=4 is introduced in version N+1 that is compatible with format=3 and it is known that version N will be able to parse it, then version N+1 will write (format=4, lowest_compatible=3) in the first two bytes of the file, and so version N will still try to parse it.
- Bitcoin ABC version N+2 introduces a new incompatible format=5. It will write (format=5, lowest_compatible=5) and so any versions that do not know how to parse format=5 will not try to read the file.
- nKey
- nNew
- nTried
- number of "new" buckets XOR 2**30
- all new addresses (total count: nNew)
- all tried addresses (total count: nTried)
- for each new bucket:
- number of elements
- for each element: index in the serialized "all new addresses"
- asmap checksum
2**30 is xorred with the number of buckets to make addrman deserializer v0 detect it as incompatible. This is necessary because it did not check the version number on deserialization.
vvNew, vvTried, mapInfo, mapAddr and vRandom are never encoded explicitly; they are instead reconstructed from the other information.
This format is more complex, but significantly smaller (at most 1.5 MiB), and supports changes to the ADDRMAN_ parameters without breaking the on-disk structure.
We don't use SERIALIZE_METHODS since the serialization and deserialization code has very little in common.
Definition at line 141 of file addrman.cpp.