-
Notifications
You must be signed in to change notification settings - Fork 116
Connect to known nodes via Noise_XK #307
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
Conversation
Since we know the pubkey of nodes we connected to previously, use Noise_XK to connect to them. Connecting to new nodes still uses Noise_XX
|
Should we have some way for forcibly connect to a known node using XX? |
|
Hm, to break the trust web that the PK provides, nice idea, maybe I'll put that into its own PR so that it doesn't delay this PR getting in :) Might want to have that option in |
|
This is cool -- not sure why you'd want to force XX though if you already have the key? It seems like the only advantage of XX is that you learn the remote key at the end. |
|
Thinking back, I don't know either. If he has a new pubkey, he'd have a new listening address as well. But might be that you want to forcibly connect because you want to reverify his PK or something.. |
|
XK mode does (re?)verify their pubkey. It just doesn't tell you it if you don't know it already. |
| logging.Info("Received pubkey", s) | ||
| if lnutil.LitAdrFromPubkey(s) != remotePKH { | ||
| logging.Infoln("Received pubkey", remotePK) | ||
| if lnutil.LitAdrFromPubkey(remotePK) != remotePKH && !Noise_XK { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to make sense to switch these clauses around, so that if Noise_XK is true it will not do the comparison.
| return nil, fmt.Errorf("Remote PKH doesn't match. Quitting!") | ||
| } | ||
| logging.Infof("Received PKH %s matches", lnutil.LitAdrFromPubkey(s)) | ||
| logging.Infof("Received PKH %s matches", lnutil.LitAdrFromPubkey(remotePK)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logging statement should be different when Noise_XK is true - you didn't check that it matches. Something like "Assuming PKH still matches" or just don't log it at all.
|
Don't merge / review yet, needs rework on top of master. |
|
Closing this in favour of #435 |
Since we know the pubkey of nodes we connected to previously, use Noise_XK to connect to them and connect to new nodes using Noise_XX