Skip to content

routing: prune single direction#2243

Merged
Roasbeef merged 3 commits into
lightningnetwork:masterfrom
joostjager:prune-single-direction
Dec 6, 2018
Merged

routing: prune single direction#2243
Roasbeef merged 3 commits into
lightningnetwork:masterfrom
joostjager:prune-single-direction

Conversation

@joostjager
Copy link
Copy Markdown
Contributor

@joostjager joostjager commented Nov 29, 2018

In this PR we introduce pruning of channel edges instead of channels. Channel failures apply to a single direction and it is unnecessarily restricting to prune both directions

Open question: for PermanentChannelFailure, should both directions be pruned?

Comment thread routing/missioncontrol.go Outdated
@halseth halseth added routing P3 might get fixed, nice to have labels Dec 3, 2018
@halseth halseth added this to the 0.5.2 milestone Dec 3, 2018
@joostjager joostjager force-pushed the prune-single-direction branch 2 times, most recently from 3f0b47e to b563ed7 Compare December 4, 2018 08:21
Copy link
Copy Markdown
Contributor

@halseth halseth left a comment

Choose a reason for hiding this comment

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

Nice! Looks more or less LGTM, only a few nits.

Comment thread routing/pathfind_test.go Outdated
Comment thread routing/testdata/basic_graph.json Outdated
Comment thread routing/testdata/basic_graph.json Outdated
Comment thread routing/testdata/basic_graph.json Outdated
Comment thread routing/pathfind.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Feel like we might as well remove this methods now?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Only spot I see it used now is the tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It was also used in getFailedChannelID. But good suggestion, removed the map, the unit test and updated getFailedChannelID.

Comment thread routing/router.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

to reduce commit size this could be introduced in a separate commit :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is too granular for me and I am also not sure if it makes sense to review a data structure without knowing what it will be used for.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It is just a personal preference of mine, as I tend to jump back and forth between commits anyway :)

Comment thread routing/router.go Outdated
@Roasbeef
Copy link
Copy Markdown
Member

Roasbeef commented Dec 5, 2018

Open question: for PermanentChannelFailure, should both directions be pruned?

Yes at this should indicate that the channel is completely unusable (say the commitment transaction has been broadcast).

Copy link
Copy Markdown
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

I dig the set of changes, always nice to be more precise. After a rebase, and the style nits addressed, this should be mostly good to go.

Comment thread routing/pathfind_test.go Outdated
Comment thread routing/pathfind.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Only spot I see it used now is the tests.

Comment thread routing/router.go Outdated
Comment thread routing/pathfind.go Outdated
There is the general assumption that channel edge policy nodes are
ordered such that the node1 pubkey is smaller than the key of node 2. In
the test graph, this assumption didn't hold. This commit fixes the test
graph and also adds a check to prevent this from happening again.
@joostjager joostjager force-pushed the prune-single-direction branch 3 times, most recently from 3404a15 to f821a2a Compare December 5, 2018 09:12
@joostjager
Copy link
Copy Markdown
Contributor Author

Open question: for PermanentChannelFailure, should both directions be pruned?

Yes at this should indicate that the channel is completely unusable (say the commitment transaction has been broadcast).

Added bidirectional pruning in case of PermanentChannelFailure

@joostjager
Copy link
Copy Markdown
Contributor Author

Comments processed

halseth
halseth previously approved these changes Dec 5, 2018
Copy link
Copy Markdown
Contributor

@halseth halseth left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Comment thread routing/router.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

style nit: continue in case errSource != hop.PubKeyBytes to avoid indentatin.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

Hop maps were used in a test to verify the population of the hop map
itself and further only in a single function (getFailedChannelID).
Rewrote that function and removed the hop maps completely.
In this commit we introduce pruning of channel edges instead of channels.
Channel failures apply to a single direction and it is unnecessarily
restricting to prune both directions.
Copy link
Copy Markdown
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

LGTM 🛸

Comment thread routing/router.go
// continue with the rest of the routes.
case *lnwire.FailPermanentChannelFailure:
paySession.ReportChannelFailure(failedChanID)
paySession.ReportEdgeFailure(&edgeLocator{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

@Roasbeef Roasbeef merged commit 45f4989 into lightningnetwork:master Dec 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 might get fixed, nice to have routing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants