Skip to content

Commit 2ea62ca

Browse files
committed
Improve docs about feeler connections
1 parent 2583966 commit 2ea62ca

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
@@ -1784,7 +1784,7 @@ void CConnman::SetTryNewOutboundPeer(bool flag)
17841784

17851785
// Return the number of peers we have over our outbound connection limit
17861786
// Exclude peers that are marked for disconnect, or are going to be
1787-
// disconnected soon (eg one-shots and feelers)
1787+
// disconnected soon (eg ADDR_FETCH and FEELER)
17881788
// Also exclude peers that haven't finished initial connection handshake yet
17891789
// (so that we don't decide we're over our desired connection limit, and then
17901790
// 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
@@ -143,10 +143,19 @@ enum class ConnectionType {
143143
MANUAL,
144144

145145
/**
146-
* Feeler connections are short lived connections used to increase the
147-
* number of connectable addresses in our AddrMan. Approximately every
148-
* FEELER_INTERVAL, we attempt to connect to a random address from the new
149-
* table. If successful, we add it to the tried table.
146+
* Feeler connections are short-lived connections made to check that a node
147+
* is alive. They can be useful for:
148+
* - test-before-evict: if one of the peers is considered for eviction from
149+
* our AddrMan because another peer is mapped to the same slot in the tried table,
150+
* evict only if this longer-known peer is offline.
151+
* - move node addresses from New to Tried table, so that we have more
152+
* connectable addresses in our AddrMan.
153+
* Note that in the literature ("Eclipse Attacks on Bitcoin’s Peer-to-Peer Network")
154+
* only the latter feature is referred to as "feeler connections",
155+
* although in our codebase feeler connections encompass test-before-evict as well.
156+
* We make these connections approximately every FEELER_INTERVAL:
157+
* first we resolve previously found collisions if they exist (test-before-evict),
158+
* otherwise connect to a node from the new table.
150159
*/
151160
FEELER,
152161

0 commit comments

Comments
 (0)