Proposed Improvements To addr Relay

Proposed Improvements To addr Relay
From: Amiti Uttarwar @ 2021-04-14 20:59 UTC (permalink / raw)
  To: bitcoin-dev

Hi all,

I’m proposing a change to addr relay in Bitcoin Core with the intention of reducing “addr blackholes”. At the current stage, I am most interested in understanding whether this change would have negative consequences for other software on the network. 

Exposure to a diverse set of addresses is important for nodes to be protected against network partitions or eclipse attacks. Ensuring addr messages propagate well is fundamental to the success of the network. In the Bitcoin p2p protocol, there are two main ways for nodes to communicate about addresses: addr gossip and getaddr requests. 

Bitcoin Core will respond to a maximum of one getaddr message for each inbound peer. Thus, the main ongoing method for updating which addresses a node knows about is through addr gossip. Self-advertisements initiate a new addr message to each peer approximately once a day. When a Bitcoin Core node receives an addr message that contains 10 or fewer addresses, it will forward them to 1-2 peers. Forwarding addresses to peers who will not relay them further effectively “blackholes” the message, reducing the ability for the addr message to successfully propagate through the network.

Although we cannot prevent addr blackholes in malicious cases, we can improve it for the more common honest cases, and reduce the overall likelihood of occurrence. Two known instances in which an honest peer would not participate in addr relay are 1. If they have opened a block-relay-only connection or 2. If they are a light client. The current blackhole behavior with block-relay-only connections is acceptable since Bitcoin Core nodes have a maximum of 2 outbound block-relay-only connections. However, improving this behavior is a prerequisite to increasing that number.

My proposal for Bitcoin Core is to identify whether or not an inbound connection is a candidate for forwarding addrs based on whether it has sent an addr related message (addr, addrv2, getaddr, sendaddrv2) over the connection. The code for this proposal can be found here: https://github.com/bitcoin/bitcoin/pull/21528. This would allow nodes to avoid sending addresses to honest connections which never intended to participate in address relay on the link. 

This proposed change in behavior could be problematic if there is software on the network that is relying on receiving addr messages, but never initiates an addr related message. (This could be easily remedied by updating the software to send a getaddr to its outbound connections.) If anyone is aware of software with this behavior, could you please point me towards it? This would be very helpful to identify if #21528 is a viable approach. 

Thank you,
Amiti

 permalink raw reply	[|nested]