Skip to content

Commit 51fa0ed

Browse files
fanquakePastaPastaPasta
authored andcommitted
Merge bitcoin#19958: doc: Better document features of feelers
2ea62ca Improve docs about feeler connections (Gleb Naumenko) Pull request description: "feeler" and "test-before-evict" are two different strategies suggest in [Eclipse Attacks on Bitcoin’s Peer-to-Peer Network](https://www.usenix.org/system/files/conference/usenixsecurity15/sec15-paper-heilman.pdf). In our codebase, we use `ConnType::FEELER` to implement both. It is confusing, up to the point that our documentation was just incorrect. This PR: - ~clarifies this aspect by renaming "ConnType::FEELER" to "ConnType::PROBE", meaning that this connections only probes that the node is operational, and then disconnects.~ - fixes the documentation ACKs for top commit: amitiuttarwar: ACK 2ea62ca. thank you! practicalswift: ACK 2ea62ca Tree-SHA512: c9c03c09eefeacec28ea199cc3f697b0a98723f2f849f7a8115edc43791f8165e296e0e25a82f0b5a4a781a7de38c8954b48bf74c714eba02cdc21f7460673e5
1 parent d6ac2b9 commit 51fa0ed

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2209,7 +2209,7 @@ void CConnman::SetTryNewOutboundPeer(bool flag)
22092209

22102210
// Return the number of peers we have over our outbound connection limit
22112211
// Exclude peers that are marked for disconnect, or are going to be
2212-
// disconnected soon (eg one-shots and feelers)
2212+
// disconnected soon (eg ADDR_FETCH and FEELER)
22132213
// Also exclude peers that haven't finished initial connection handshake yet
22142214
// (so that we don't decide we're over our desired connection limit, and then
22152215
// evict some peer that has finished the handshake)

src/net.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,19 @@ enum class ConnectionType {
161161
MANUAL,
162162

163163
/**
164-
* Feeler connections are short lived connections used to increase the
165-
* number of connectable addresses in our AddrMan. Approximately every
166-
* FEELER_INTERVAL, we attempt to connect to a random address from the new
167-
* table. If successful, we add it to the tried table.
164+
* Feeler connections are short-lived connections made to check that a node
165+
* is alive. They can be useful for:
166+
* - test-before-evict: if one of the peers is considered for eviction from
167+
* our AddrMan because another peer is mapped to the same slot in the tried table,
168+
* evict only if this longer-known peer is offline.
169+
* - move node addresses from New to Tried table, so that we have more
170+
* connectable addresses in our AddrMan.
171+
* Note that in the literature ("Eclipse Attacks on Bitcoin’s Peer-to-Peer Network")
172+
* only the latter feature is referred to as "feeler connections",
173+
* although in our codebase feeler connections encompass test-before-evict as well.
174+
* We make these connections approximately every FEELER_INTERVAL:
175+
* first we resolve previously found collisions if they exist (test-before-evict),
176+
* otherwise connect to a node from the new table.
168177
*/
169178
FEELER,
170179

0 commit comments

Comments
 (0)