Skip to content

Conversation

@matthawkins90
Copy link
Contributor

Similar to #3406, this work heavily references the work started in #2627, with the ultimate goal of adding support for TorV3 and other network address types.

The first commit fixes a minor bug where, if a node is asked to share addresses, but it only knows a very tiny number of addresses (less than five), it wouldn't share any. This isn't considered good behavior. I found this bug while trying to write tests for the second commit, where I added the ability to ask for addresses that match a certain filter. The bugfix is to always share at least one address (of the specified type) if any are known.

The second commit adds the ability to filter net addresses by specific address types. Eventually, this can be changed based on wire protocol versions which support different address types.

The third commit removes DNS from the address manager. With this proposed plan, the address manager will only be responsible for storing and managing addresses, encoded so that they're serialized compactly. The responsibility of dialing DNS has been moved to server.go.

Prior to this fix, the calculation for numAddresses was a floor value.
This resulted in sharing 0 addresses if less than 5 were known.  Sharing
0 addresses is not good behavior when 1-4 are known, so the calculation
has been changed to be a ceiling value.  This results in always sharing
at least one address if at least one is known.
@matthawkins90 matthawkins90 force-pushed the addrmgr_filter_and_dns branch from 1a6de05 to 93e9f55 Compare July 22, 2024 00:03
@davecgh davecgh added this to the 2.1.0 milestone Aug 2, 2024
This commit introduces a network address type filter that allows a
caller to indicate the types of addresses that will be returned from the
address manager.  This allows finer control of what types of addresses
may be broadcast to a particular peer.  The filters are decided by the
protocol version in a way that allows the address manager's internal
implementation to remain agnostic of the protocol versioning logic.
@matthawkins90 matthawkins90 force-pushed the addrmgr_filter_and_dns branch from 93e9f55 to 8d458a7 Compare August 6, 2024 05:09
Copy link
Member

@davecgh davecgh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updates look good. Just a couple of nits left and I think this will be good to merge.

This removes the need to perform DNS lookups in the address manager. The
direction forward is similar to that of BIP 155: addrv2. The address
manager stores encoded versions of each address type, and doesn't need
to know how to dial each type.
@matthawkins90 matthawkins90 force-pushed the addrmgr_filter_and_dns branch from 8d458a7 to 2ad6676 Compare August 6, 2024 05:55
@davecgh davecgh merged commit fe43331 into decred:master Aug 6, 2024
@matthawkins90 matthawkins90 deleted the addrmgr_filter_and_dns branch August 6, 2024 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants