The bitcoin client hard codes a limit of 8 outbound connections and 2 block-only connections. Your node will try to always maintain these 10 outbound connections with reliable peers as a defense against network attacks. But there is an ephemeral 11th outbound connection called a feeler connection. What is the purpose of a feeler connection and how does it work?
3I think it's 8 regular outbound, 2 blocks-only and a feeler connection. :)– Murch is on strike ♦Feb 4, 2022 at 15:52
A feeler connection is a short-lived outbound connection that only starts up after your node has established the required 8 outbound connections and 2 block-relay-only outbound connections. The purpose of a feeler connection is to regularly test addresses from the "new" table to see if they are connectable bitcoin nodes. Essentially, the feeler connection cleans the trash out of "new" and populates the "tried" table with valid addresses.
- The "new" table contains untested addresses that the node has learned about from the gossip network.
- The "tried" table contains addresses that the node has successfully connected to.
Every 2 minutes the feeler connection will do one of two things:
- Pull a random peer from the eviction buffer (list of addresses considered for eviction because a new peer is mapped to the same slot in "tried"). Test the address by trying to connect to it and, if successful, remove that entry from the buffer. If this address is not connectable, evict it from "tried" and replace with a different address (previously pulled from "new").
- If the eviction buffer is empty, test a random connection from "new" and, if successful, move it to "tried". If unsuccessful, update the address connection statistics accordingly. Tangentially, if an address fails to connect enough times (among other criteria) it will be labelled "terrible". If an incoming address collides with a terrible address, the terrible address will be evicted from the "new" table.
Feeler connections are disabled when no new blocks have been received for 30 minutes. In this case, the feeler connection is turned off and its connection slot is used every 10 minutes to try to find a node that knows about a new block. This is to try to detect and circumvent a network partition without overloading the number of inbound connection slots available on the network. Once a new block is discovered, the feeler connection reverts to cleaning out the eviction buffer and the "new" table.
Feeler connections are one of the suggested countermeasures of the paper "Eclipse Attacks on Bitcoin’s Peer-to-Peer Network" and were introduced with PR#8282 to increase the number of online addresses in the tried table and later PR#9037 implemented the test-before-evict functionality.
2One addendum to your otherwise great answer: If we try a feeler connection and the attempt is unsuccessful, the address is not immediately evicted from new. Instead, its statistics are updated similar to non-feeler connection attempts (by calling Attempt() in addrman), which may lead to it being "Terrible" and evicted at some later point in time - but only in the case of a collision with another added address that would occupy the same position in addrman. In the absence of collisions, it will stay addrman, no matter how often we fail to connect to it. Mar 10, 2022 at 20:13
Thanks for the feedback, @Lightlike! I have updated my answer accordingly. :)– vnprcMar 15, 2022 at 15:10
Answer by vnprc explains the details of feeler connections. I was not sure about the term 'feeler' so checked the meaning:
an animal organ such as an antenna or palp that is used for testing things by touch or for searching for food.
As mentioned in other answer the purpose of a feeler connection is to regularly test addresses for connections so 'feeler' is correct term for such connections.