Skip to content

routing: proportional attempt cost#4602

Merged
joostjager merged 3 commits into
lightningnetwork:masterfrom
joostjager:proportional-attempt-cost
Sep 16, 2020
Merged

routing: proportional attempt cost#4602
joostjager merged 3 commits into
lightningnetwork:masterfrom
joostjager:proportional-attempt-cost

Conversation

@joostjager
Copy link
Copy Markdown
Contributor

@joostjager joostjager commented Sep 8, 2020

In #2802 probability based routing was introduced. One of the control parameters introduced is the payment attempt cost.

The payment attempt cost is a virtual cost that is assigned to a failed payment attempt. This parameter influences the trade off between cheap and reliable routes. Specifically it adds an extra term to the pathfinding cost function of attempt_cost / probability.

Probability estimation is based on past failures and successes. The impact of failures on probability estimates diminishes relatively quickly (default "half life time" is one hour), but success experiences keep having a constant effect on probability until a failure happens.

For a presentation about mission control, see https://twitter.com/joostjgr/status/1186177262238031872.

For nodes that aren't continuously sending payments and use default mission control parameters, it is likely that failures don't have much impact on mission control performance beyond the currently active payment. For those nodes, recorded information about previously successful routes is the main driver for pathfinding.

The probability estimate is 60% (by default) for unknown hops (or hops with older failures recorded) and 95% for previously successful hops.

Suppose:

  • There is a route S through a success hop with routing fee 0.1%
  • There is a route U though an unknown hop with routing fee 0.01%
  • We are sending 4M sats

What should the attempt cost c be set to for pathfinding to choose route S?
4M * 0.1% + c / 0.95 = 4M * 0.01% + c / 0.6
Solving for c results in an attempt cost = 5863 sats.

So we need to set a pretty high attempt cost to not get distracted by unknown routes. In the reality of the Lightning Network, these unknown routes do often fail and cause a lengthy payment process. Good liquidity isn't the cheapest liquidity generally.

The current default attempt cost is set at 100 sat. For the scenario described above with a relatively large gap in fees and a mid-size payment amount, the default setting would effectively disable probability based routing and lead to a lot of exploration even though successful routes may be known.

One thing that becomes clear is that an absolute attempt cost is unlikely to work for every payment amount. This PR therefore introduces an additional control parameter that allows setting a proportional attempt cost as well. The goal of this is to improve the default pathfinding performance in particular for large payment amounts.

Make field names consistent with the command line flag.
@joostjager joostjager force-pushed the proportional-attempt-cost branch 2 times, most recently from 10a8b5e to 20fe6c7 Compare September 8, 2020 12:29
@joostjager joostjager force-pushed the proportional-attempt-cost branch from 20fe6c7 to d32265e Compare September 8, 2020 13:29
@joostjager joostjager force-pushed the proportional-attempt-cost branch from d32265e to bbfeeec Compare September 8, 2020 13:47
@joostjager
Copy link
Copy Markdown
Contributor Author

An idea brought up by @halseth in the past is to bump up the payment attempt cost. So similar to what is sometimes done with RBF, start with a low payment attempt cost (go for the cheapest route), but if that turns out to be difficult, start bumping the attempt cost up to move towards reliable routes.

@joostjager joostjager requested review from halseth and removed request for Roasbeef September 15, 2020 19:52
Copy link
Copy Markdown
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.

Solid change, definitely makes sense to begin exposing this level control as the average channel/payment size becomes larger! Diff is otherwise straightforward 👍

An idea brought up by @halseth in the past is to bump up the payment attempt cost. So similar to what is sometimes done with RBF, start with a low payment attempt cost (go for the cheapest route), but if that turns out to be difficult, start bumping the attempt cost up to move towards reliable routes.

this does seem like a good direction to explore. it does seem to add a good amount of complexity compared to your proposed changes. it would be interesting if the fee ratcheting could explore the fixed and proportional coefficients simultaneously...

Comment thread sample-lnd.conf

; The (virtual) proportional cost in ppm of the total amount of a failed payment
; attempt (default: 1000)
; routerrpc.attemptcostppm=900
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this match the default value?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It seems that we use other values than the default in this file. Probably to demonstrate what it looks like with a non-default value.

Copy link
Copy Markdown
Contributor

@halseth halseth left a comment

Choose a reason for hiding this comment

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

Good change! Definitely sounds like this is a good first step, then we can explore the more complex dynamic attempt cost at a later point.

@joostjager joostjager merged commit 3531c3f into lightningnetwork:master Sep 16, 2020
@Roasbeef Roasbeef added this to the 0.12.0 milestone Dec 19, 2020
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.

4 participants