Skip to content

xpay: stop retrying a node that repeats unknown_next_peer - #9592

Open
vincenzopalazzo wants to merge 2 commits into
ElementsProject:masterfrom
vincenzopalazzo:fix/xpay-unknown-next-peer
Open

vincenzopalazzo wants to merge 2 commits into
ElementsProject:masterfrom
vincenzopalazzo:fix/xpay-unknown-next-peer

Conversation

@vincenzopalazzo

Copy link
Copy Markdown
Collaborator

Summary

  • xpay treated unknown_next_peer as a single-channel failure. That is the code lnd returns when the next peer is offline, so a well-connected node was retried on every other channel until retry_for expired. Fixes Bug: xpay fails because it keeps retrying paths over the same node #9590.
  • The first failure still only disables that channel. A stale scid should not take the node out of every path.
  • A second unknown_next_peer from the same node calls askrene-disable-node on the private payment layer, so getroutes stops handing back the rest of its channels.

Test plan

  • test_xpay_unknown_next_peer_excludes_node fails on master: 4 attempts, one unknown_next_peer per hub channel (assert 4 <= 2)
  • Same test passes with the fix: 2 attempts, then Repeated unknown_next_peer from <hub>: disabling node for this payment
  • CI

unknown_next_peer means the reporting node cannot forward, which is
what lnd returns when the next peer is offline. xpay only disables the
failed channel, so getroutes hands back every other channel through the
same node.

This test fails a hub with four exits using that code. On current xpay
it walks all four:

    Failed after 4 attempts. We got a weird error (unknown_next_peer)
    for 131x1x0/1 ... 124x1x0/1 ... 117x1x0/1 ... 110x2x0/0
    assert 4 <= 2

Marked xfail until the next commit excludes the node after the repeat.

Changelog-None.
The previous commit fails because xpay disables only the channel. A
second unknown_next_peer from the same node now calls
askrene-disable-node on this payment's private layer, so getroutes
stops handing back the rest of its channels.

The first failure still only disables that channel. One stale scid
must not take a well-connected node out of every path.
temporary_channel_failure and fee or CLTV errors are unchanged.

Removes the xfail from test_xpay_unknown_next_peer_excludes_node.
With the fix that test stops after two attempts:

    Repeated unknown_next_peer from <hub>: disabling node for this payment

Fixes ElementsProject#9590.
Changelog-Fixed: xpay no longer retries every channel through a node that keeps returning unknown_next_peer.
@vincenzopalazzo
vincenzopalazzo force-pushed the fix/xpay-unknown-next-peer branch from bab20a2 to a97e697 Compare September 30, 2026 22:02

This branch has not been deployed

No deployments
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.

Bug: xpay fails because it keeps retrying paths over the same node

1 participant