Skip to content
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

lnwire+peer: fully validate node aliases on the wire, don't d/c due to invalid aliases #2412

Merged
merged 3 commits into from Jan 8, 2019

Conversation

Roasbeef
Copy link
Member

@Roasbeef Roasbeef commented Jan 4, 2019

No description provided.

halseth
halseth previously approved these changes Jan 4, 2019
peer.go Outdated Show resolved Hide resolved
@Roasbeef
Copy link
Member Author

Roasbeef commented Jan 4, 2019

Comment addressed, PTAL @halseth

peer.go Outdated
// If the NodeAnnouncement has an invalid alias, then
// we'll log that error above and continue so we can
// continue to read messges from the peer.
case lnwire.ErrInvalidNodeAlias:
Copy link
Contributor

Choose a reason for hiding this comment

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

This should have a test if possible. I think maybe this should be a pointer as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

There isn't a good way to make an accurate end to end test for this as we don't allow local nodes to set the value, and we don't yet have a p2p testing framework in place. Correct on pointer, just added! We do currently have unit tests that cover validation however.

In this commit, we ensure that when we read node aliases from the wire,
we ensure that they're valid. Before this commit, we would read the raw
bytes without checking for validity which could result in us writing in
invalid node alias to disk. We've fixed this, and also updated the
quickcheck tests to generate valid strings.
Copy link
Contributor

@cfromknecht cfromknecht left a comment

Choose a reason for hiding this comment

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

LGTM! 💯

Copy link
Contributor

@wpaulino wpaulino left a comment

Choose a reason for hiding this comment

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

LGTM 💥

@Roasbeef Roasbeef merged commit 0725fec into lightningnetwork:master Jan 8, 2019
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.

None yet

4 participants