-
Notifications
You must be signed in to change notification settings - Fork 2.2k
server: configurable feature negotiation + downgrade to optional compat #1838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cfromknecht
wants to merge
8
commits into
lightningnetwork:master
Choose a base branch
from
cfromknecht:downgrade-required-features
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
server: configurable feature negotiation + downgrade to optional compat #1838
cfromknecht
wants to merge
8
commits into
lightningnetwork:master
from
cfromknecht:downgrade-required-features
Conversation
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
f7704da
to
9603a25
Compare
9603a25
to
26da8b8
Compare
26da8b8
to
895c969
Compare
In this commit, we thread down an error chan from the server's ConnectToPeer method to the point at which a peer is started. This enables the caller to be aware of issues in exchange init messages. This is additional info is useful for subsystems like autopilot, which will currently try to open a channel after knowing the dial succeeded, but unaware if the peers are actually compatible.
Since peer start errors are now bubbled up to the caller, this error can now be received when connecting non-permanent peers. If we encounter this when trying EnsureConnceted, we will assume the peers are trying to connect, and wait for the peers to appear in each other's list of peers.
This commit adds 3 basic levels of feature bit negotiation: off, optional, and required. Only optional and required will be used initially, as fully disabling a known feature would require a fair amount of extra work. However, these values are intended to correspond to command line flags that can be passed to lnd on startup.
This commit adds a conf struct for setting feature bits from the command line. The current supported features are related gossip queries and data loss protection.
This commit adds the required logic to downgrade a required feature bit to an optional one if they do not understand the required feature bit. On the first connection, we will detect the case in which we offered required and they gave optional. If the peers are disconnected for any reason, we note the peer's support for optional gq or dlp, and initiate a downgraded attempt on the next connection if we wish the feature to be required. This downgrade will be applied on all subsequent connections to remove uncertainty that not understanding the required feature bits was the reason for disconnecting the first time. Finally, if the are using a downgraded connection because the peer initially reported optional support, but later advertises that they don't support the feature at all, we fail the connection. This is to maintain the fact that we can only enter a downgraded connection if the user requested that it be required. Accepting the connection would break that contract with the user user's expectations.
895c969
to
a5dbe37
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
interop
interop with other implementations
needs review
PR needs review by regular contributors
p2p
Code related to the peer-to-peer behaviour
P3
might get fixed, nice to have
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.
Alternative approach to #1801