Skip to content

Conversation

@Varunram
Copy link
Contributor

@Varunram Varunram commented Aug 3, 2018

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

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
@delbonis
Copy link
Collaborator

delbonis commented Aug 6, 2018

Should we have some way for forcibly connect to a known node using XX?

@Varunram
Copy link
Contributor Author

Varunram commented Aug 6, 2018

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 lit itself to ensure that we don't trust anyone by their PKs permanently.

@adiabat
Copy link
Collaborator

adiabat commented Aug 20, 2018

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.

@Varunram
Copy link
Contributor Author

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..

@adiabat
Copy link
Collaborator

adiabat commented Aug 20, 2018

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 {
Copy link
Contributor

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))
Copy link
Contributor

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.

@Varunram
Copy link
Contributor Author

Varunram commented Sep 20, 2018

Don't merge / review yet, needs rework on top of master.

@Varunram
Copy link
Contributor Author

Closing this in favour of #435

@Varunram Varunram closed this Nov 21, 2018
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.

4 participants