Skip to content

routing: pathfinding should avoid repeated channels in self-routes with 2 hops #10873

Description

@ziggie1984

Background

QueryRoutes/pathfinding can produce self-payment routes that use the same
channel twice, for example:

self -> peer -> self

where both hops use the same SCID in opposite directions. This falls out of the
existing source == target special case in pathfinding: self-payments/rebalances
must be allowed to return to the source, but the shortest return path may be the
same channel.

Scope clarification

After looking closer, this appears to be a narrow 2-hop self-route problem rather
than a general cleartext pathfinding problem.

For normal non-self routes, reusing a channel would require revisiting one of the
channel endpoints, so the existing node-cycle avoidance should already prevent
that. Longer self-route loops that repeat an intermediate node should be covered
by the same mechanism.

The problematic cleartext case is:

self -> peer -> self

where the only repeated node is the source/target itself, which pathfinding
intentionally allows for self-payments.

For rebalancing, this route shape appears useless because it does not move
liquidity between distinct local channels. It can still lock liquidity, incur
fees, or fail later at forwarding time.

Metadata

Metadata

Assignees

Labels

bugUnintended code behaviour

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions