doc, test: Test and explain service flag handling

Service flags are handled differently, depending on whether
validated (if received from the peer) or unvalidated (received
via gossip relay).
This commit is contained in:
Martin Zumsande
2024-01-09 14:04:51 -05:00
parent b3b19be20d
commit 74ebd4d135
3 changed files with 34 additions and 2 deletions

View File

@@ -111,13 +111,16 @@ public:
/**
* Attempt to add one or more addresses to addrman's new table.
* If an address already exists in addrman, the existing entry may be updated
* (e.g. adding additional service flags). If the existing entry is in the new table,
* it may be added to more buckets, improving the probability of selection.
*
* @param[in] vAddr Address records to attempt to add.
* @param[in] source The address of the node that sent us these addr records.
* @param[in] time_penalty A "time penalty" to apply to the address record's nTime. If a peer
* sends us an address record with nTime=n, then we'll add it to our
* addrman with nTime=(n - time_penalty).
* @return true if at least one address is successfully added. */
* @return true if at least one address is successfully added, or added to an additional bucket. Unaffected by updates. */
bool Add(const std::vector<CAddress>& vAddr, const CNetAddr& source, std::chrono::seconds time_penalty = 0s);
/**