Skip to content

Improvement to payment splitting algorithm #1698

@t-bast

Description

@t-bast

The splitting algorithm biases too much towards good routes, regardless of capacity.
We first find routes, keep the N bests and then adjust capacity.

But it may end up using only routes with the same first hop, whereas the first link doesn't have enough capacity for the whole payment, and we discarded routes with a different first hop in the first phase.

We need to somehow incorporate in Yen's algorithm information about the amounts already used up by previous routes found.

Here is a pathological example:

      M1 channels with fee>0   +-----+   M2 channels with fee>0 
    +------------------------> | Bob | ---------------------------------------+
    |                          +-----+                                        |
    |                                                                         |
    |                                                                         |
    |                                                                         v
+--------+   N1 channels with fee=0   +-----+   N2 channels with fee=0   +-----------+
| Sender | -------------------------> | HUB | -------------------------> | Recipient |
+--------+                            +-----+                            +-----------+

If all the channels between HUB and Recipient are depleted (empty on HUB's side) the payment will fail, because the current algorithm will return only routes that go through HUB (if there are a lot of matching channels with very competitive fees there).

It's a tricky case, because the sender doesn't know the liquidity between HUB and Recipient, and if there was some liquidity available, this would be the best route (so it's correct to try it). Maybe the second payment attempt (if the first one fails) should exclude HUB?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions