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

routing: check max routing info size #3841

Merged
merged 8 commits into from
Dec 20, 2019

Conversation

joostjager
Copy link
Contributor

@joostjager joostjager commented Dec 16, 2019

This PR modifies pathfinding to check the accumulated total payload size during search. This ensures that we will never find a route that exceeds the limit of 1300 bytes.

In order to execute this check, it is necessary to take into account whether nodes along the route support tlv (this influences the payload size). The size of custom records that are possibly present is added as well.

@joostjager joostjager requested a review from Roasbeef as a code owner December 16, 2019 14:29
@joostjager joostjager self-assigned this Dec 16, 2019
@joostjager joostjager removed the request for review from Roasbeef December 16, 2019 18:49
@joostjager joostjager added this to the 0.9.0 milestone Dec 16, 2019
@joostjager joostjager force-pushed the check-max-onion-size branch 2 times, most recently from 13f9029 to 6df01de Compare December 17, 2019 11:45
@joostjager joostjager force-pushed the check-max-onion-size branch 7 times, most recently from 0689a2c to 9063c3d Compare December 18, 2019 11:46
routing/pathfind.go Outdated Show resolved Hide resolved
routing/pathfind.go Show resolved Hide resolved
channeldb/graph.go Outdated Show resolved Hide resolved
routing/testdata/excessive_hops.json Show resolved Hide resolved
routing/pathfind.go Outdated Show resolved Hide resolved
routing/pathfind.go Outdated Show resolved Hide resolved
@joostjager joostjager force-pushed the check-max-onion-size branch 3 times, most recently from f80d87e to 810dfbc Compare December 18, 2019 13:05
@joostjager joostjager changed the title routing: check max routing info size [do not review] routing: check max routing info size Dec 18, 2019
@joostjager joostjager force-pushed the check-max-onion-size branch 2 times, most recently from 0d9a287 to c3fa681 Compare December 18, 2019 13:54
@bhandras bhandras self-requested a review December 18, 2019 15:17
Copy link
Collaborator

@bhandras bhandras left a comment

Choose a reason for hiding this comment

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

LGTM, only nits.

routing/pathfind.go Outdated Show resolved Hide resolved
routing/pathfind.go Show resolved Hide resolved
routing/pathfind.go Outdated Show resolved Hide resolved
This prevents inefficient key conversions in a follow up commit that
change the inner pathfinding loop.
@joostjager joostjager force-pushed the check-max-onion-size branch 2 times, most recently from 5452295 to 6d5d415 Compare December 19, 2019 12:03
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.

Solid fix, LGTM 👍

routing/pathfind.go Outdated Show resolved Hide resolved
@joostjager
Copy link
Contributor Author

Itest failing, need to investigate

To allow execution within an existing tx.
Also prepares for payload size tracking during pathfinding
@joostjager
Copy link
Contributor Author

Itest fixed, db transaction problem for which I added a commit

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 now that deadlock is fixed. Nice that we can get rid of the arbitrary limit in favor of a physical constraint! 💯

routing/pathfind.go Outdated Show resolved Hide resolved
Enable the test again and use a programmatically built network.
Also the max hop count check can be removed, because the real bound is
the payload size. By moving the check inside the search loop, we now
also backtrack when we hit the limit.
@joostjager joostjager merged commit 6e0cfe5 into lightningnetwork:master Dec 20, 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.

3 participants