libbitcoin / libbitcoin-network

Bitcoin P2P Network Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about addr handling

amitiuttarwar opened this issue · comments

Hi! I'm proposing some changes to addr handling in Bitcoin Core, and trying to ensure there will not be negative consequences for other clients on the network. For more information about the changes, please see my mailing list post. The crux is that, if the changes are accepted, bitcoin core would stop sending addr messages to peers who don't "indicate interest" aka initiate an addr-related message (addr, addrv2, getaddr, or sendaddrv2).

I'd like to ensure that libbitcoin clients will initiate an addr related message to outbound peers. I've looked in the code and believe the software plays nice, and am looking for a +1 from someone more familiar with this project.

This is my understanding: in session_outbound.cpp, attach_protocols is called as part of the process of starting up a new outbound connection (link). This function invokes protocol_address_31402::start, which sends a getaddr message (link). And it seems this is also the case for manual connections (link).

I also found that the starting sequence of session_seed.cpp invokes protocol_seed_31402::start (link), which looks like it sends a getaddr and self advertises its own address (link).

Although my understanding is incomplete (does the node self announce to seeds, but not to normal outbound / manual connections?), if my claims above are accurate, there should be no compatibility issues with my proposed changes.

tldr; I'm proposing a change to Bitcoin Core and want to make sure it does not break libbitcoin clients, can someone confirm my understanding of the code?

Thanks in advance!
Amiti

The node advertises itself on all sessions where the address protocol is attached (default for all three types).

The seeding session is distinct because of a limited set of attached protocols, and a specific timeout on connections. The only other distinction is that seed nodes (any node) are listed in config.

Thanks for the heads up.

awesome, thank you for confirming!