server: Create peer netaddr during construction.#3625
Merged
davecgh merged 1 commit intodecred:masterfrom Mar 3, 2026
Merged
Conversation
eb173bf to
ecddc3a
Compare
davecgh
commented
Mar 3, 2026
The recent code that added v2 address support modified the way the net address that represents the remote peer address is handled to override the one returned from the base peer. As the author explained in the commit that made the change, it was the least intrusive way to integrate the new addresses. Unfortunately, the approach is rather inefficient because it involves creating the same object every time it's invoked. This takes an entirely different approach to greatly simplify the handling by decoupling it from the peer package altogether. This will ultimately allow the NA method to be removed from the base peer completely which will also simplify its API. With that in mind, this creates the network address once from the initial connection object prior to construction of the peer and stores it in the server peer instance. The base peer NA method is no longer used after this change and can be removed in a future commit.
ecddc3a to
e03af10
Compare
jrick
approved these changes
Mar 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The recent code that added v2 address support modified the way the net address that represents the remote peer address is handled to override the one returned from the base peer. As the author explained in the commit that made the change, it was the least intrusive way to integrate the new addresses. Unfortunately, the approach is rather inefficient because it involves creating the same object every time it's invoked.
This takes an entirely different approach to greatly simplify the handling by decoupling it from the peer package altogether. This will ultimately allow the NA method to be removed from the base peer completely which will also simplify its API.
With that in mind, this creates the network address once from the initial connection object prior to construction of the peer and stores it in the server peer instance. The base peer NA method is no longer used after this change and can be removed in a future commit.