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

htlcswitch: fix non-strict forwarding failures #3547

Merged
merged 9 commits into from
Oct 23, 2019

Conversation

joostjager
Copy link
Contributor

This PR fixes inconsistencies in the returned failure messages when forwarding non-strict.

@joostjager joostjager changed the title Non strict error htlcswitch: fix non-strict forwarding failures Sep 27, 2019
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.

Nice fix and refactor!

htlcswitch/link.go Outdated Show resolved Hide resolved
htlcswitch/link.go Show resolved Hide resolved
htlcswitch/interfaces.go Outdated Show resolved Hide resolved
htlcswitch/link.go Outdated Show resolved Hide resolved
htlcswitch/interfaces.go Outdated Show resolved Hide resolved
htlcswitch/switch.go Show resolved Hide resolved
htlcswitch/link.go Show resolved Hide resolved
@joostjager joostjager added this to the 0.9 milestone Oct 8, 2019
htlcswitch/link.go Outdated Show resolved Hide resolved
htlcswitch/interfaces.go Outdated Show resolved Hide resolved
htlcswitch/link_test.go Outdated Show resolved Hide resolved
htlcswitch/link.go Show resolved Hide resolved
htlcswitch/switch.go Show resolved Hide resolved
htlcswitch/interfaces.go Outdated Show resolved Hide resolved
@joostjager joostjager force-pushed the non-strict-error branch 5 times, most recently from acb7e9b to 8de45d9 Compare October 9, 2019 15:23
Copy link
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 ☄️

Needs a rebase, then ready to land!

}

// genIDs generates ids for two test channels.
func genIDs() (lnwire.ChannelID, lnwire.ChannelID, lnwire.ShortChannelID,
Copy link
Member

Choose a reason for hiding this comment

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

👍

In the scenario where the requested channel does not have enough balance
and another channel towards the same node generates a different failure,
we erroneously returned UnknownNextPeer instead of the expected
TemporaryChannelFailure.

This commit rewrites the non-strict forwarding logic in the switch to
return the proper failure message. Part of this is moving the link
balance check inside the link.
@joostjager joostjager self-assigned this Oct 23, 2019
@joostjager joostjager merged commit 3cfd1eb into lightningnetwork:master Oct 23, 2019
@wpaulino wpaulino removed their request for review October 23, 2019 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants