Repository navigation
xpay: stop retrying a node that repeats unknown_next_peer #9592
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
Open
vincenzopalazzo
wants to merge
4
commits into
ElementsProject:master
Choose a base branch
from
vincenzopalazzo:fix/xpay-unknown-next-peer
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+118
−1
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
35b56e6
pytest: show xpay retries every channel on unknown_next_peer
vincenzopalazzo a97e697
xpay: exclude a node that repeats unknown_next_peer
vincenzopalazzo 71214c5
fixup! pytest: show xpay retries every channel on unknown_next_peer
vincenzopalazzo e39a6b8
fixup! xpay: exclude a node that repeats unknown_next_peer
vincenzopalazzo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #!/usr/bin/env python3 | ||
| """Fail payment forwards with unknown_next_peer. Leave local invoices alone. | ||
|
|
||
| Used by test_xpay_unknown_next_peer_excludes_node (issue 9590). | ||
| """ | ||
| from pyln.client import Plugin | ||
|
|
||
| plugin = Plugin() | ||
|
|
||
|
|
||
| @plugin.hook("htlc_accepted") | ||
| def on_htlc_accepted(onion, plugin, **kwargs): | ||
| # Forwards carry forward_msat. Local invoices and funding HTLCs do not. | ||
| if not isinstance(onion, dict) or onion.get("forward_msat") is None: | ||
| return {"result": "continue"} | ||
| plugin.log("failing forward with unknown_next_peer") | ||
| # WIRE_UNKNOWN_NEXT_PEER = PERM | 10 = 0x400a | ||
| return {"result": "fail", "failure_message": "400a"} | ||
|
|
||
|
|
||
| plugin.run() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why disable the reporting node?
We should disable the unreachable node instead.
Alternatively we could at first distrust both the reporter (A) and next node (B), keep that in record and disable the channel. Next time we hit another channel with the same error and the same pair (A->B) we figure that there is something wrong with
these two, so we disable every parallel channel between them.
If we see another report of C failing with unknown next peer B, then we know for sure B was the problem
and we disable B.
Or if we see another report A failing with unknown next peer D, then we know is A the problem, and we disable A.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a bug. unknown_next_peer does not name the next peer. It is PERM|10, channel scoped, and the onion only carries the scid the reporter rejected. hops[index - 1].next_node is that reporter, and that is the node we disable on the second hit. That is the #9590 case: one hub returns unknown_next_peer on every exit, so getroutes keeps handing back the other channels. The first hit still only disables that channel, so one stale scid does not take the node out.
Disabling hops[index].next_node on the first repeat would drop a live peer when the upstream lied or has a stale scid. The A/B record, then disable B only if C also reports B, or A if A reports a different next peer, is the right distinction. It needs new per-payment state and tests for both cases. Happy to do that as a follow-up. Does that address your concern, or did I misunderstand?