-
Notifications
You must be signed in to change notification settings - Fork 905
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
Proposal: routetricks
plugin
#3001
Comments
Does "built-in" means this plugin must be started by default like the |
I think that it means it has to be placed into the |
Indeed. In theory we can start up C-Lightning currently with Python not installed (Python is used for tests and the plugins in the separate repo and generation of some code, but is not required for C-Lighning startup, and "should" not be required when compiling from .tgz). Though this might eventually be loosened if we have an important plugin that is already written in another language and want to add it in the out-of-the-box setup in the future. |
Analogy to RTS, the path finding algorithm must consider the path weight? |
|
@ZmnSCPxj: I already have a cronjob doing exactly this. Could you explain what you mean by "negative utility"? It's been working fantastically well for me. |
@whitslack There is an edge case where a remote payer thinks you still have 0 channel fees but you have set already set your channel fees to non-zero (but the If the remote payer is C-Lightning, regardless of failure code, the channel that fails is excluded, which reduces the probability you will be routed through on the next attempt. In principle, rather than excluding the channel that returns Do note that this passive-rebalance will be discouraged by #3064. See also: https://lists.linuxfoundation.org/pipermail/lightning-dev/2019-September/002157.html |
@ZmnSCPxj: Doesn't this directly contradict the recommendation in BOLT #7:
?
Isn't this the expected behavior implied by the spec? Is there an open issue for implementing this in C-Lightning? |
It is a "SHOULD" so we are allowed to not follow it. It can probably be done. Alternatively maybe it is already implemented, I have not looked at the forwarding code for a long while already, it was a mess the last time I looked at it.
Yes. Currently C-Lightning |
Introduction
In #2890 (comment) @rustyrussell expresses the opinion to move
permuteroute
to a plugin.I am currently busy on
getroutequick
, and additionally, also in non-Bitcoin-related tasks, thus cannot do this yet.So I add this sketch here.
routetricks
is a "built=in" plugin, as it will provide some functionality that will (eventually) be done bypay
, which itself is a built-in plugin.This provides the commands below:
recalcroute
- Recompute the fees of a route.smoothenroute
- Remove cycles in a route.permuteroute
- Modify an existing route to avoid known-failing channels / nodes.recalcroute
Usage:
Recompute the fees and delays of the given route, or fail if any channel or node is not existing in our local routemap.
This simply does
listchannels
on each channel along theroute
to get thedelay
,base_fee_millisatoshi
, andfee_per_millionth
, starting from the end.In addition, the
route
is validated so that each hop connects to the previous via the given channel, and that the first hop is directly connected tofromid
(if specified), or our own node (iffromid
not specified).If
msatoshi
andcltv
are unspecified, they will be extracted from the last hop of the input route.Usefulness
smoothenroute
, which is needed forpermuteroute
.recalcroute
a route which fails a given amount to try to use a smaller amount, hence whymsatoshi
can be specified.pay
receives afailure_code
with theUPDATE
bit set, rather than add the specified channel to the currentexcludes
set, it should attempt arecalcroute
first: ifrecalcroute
succeeds and gives a different value at the first hop than the input route, then it should re-attempt the same route with the new fee setup as long as the new setup is still within themaxfeepercent
andmaxdelay
.setchannelfees
depending on how much we own of a channel (set fee to 0 if e.g. >75% is owned by us, double the normal fee if e.g. <25% is owned by us, etc.). Ifcommon
payimplementations cannot handle
UPDATE` failures, then it would be negative utility to install such a plugin.smoothenroute
Usage:
Eliminates cycles in the given route.
This does not require direct lookup on the routemap unless actual smoothening is done. Simply requires an O( n^2 ) loop where we compare each node (starting from
fromid
or our own node) with every succeeding node. If we find a match, then eliminate all hops up to and including the matched hop node.This has to keep track of a "largest index changed" which is the largest index (of the outer loop!) that matched a later hop (and thus triggered a deletion of some hops). This is needed since we also have to
recalcroute
up to that section, but we probably do not want torecalcroute
the entire route (in case the latter part was constructed by adding routehints).For example, if the input was:
Then
smoothenroute
would result in:But we only need to
recalcroute
up to the below and concatenate with the postfix:(because the
d->e
route might be a routehint and thus not in the routemap)Which should yield something like:
Usefulness
smoothenroute
afterwards.permuteroute
needs this as it performs path splicing, creating multiple path subsections and concatenating them.smootheroute
should be used afterwards to remove unnecessary cycles in the route.permuteroute
Usage:
Create an alternative route from a given route, skipping over a failing channel or node.
If the given
failure_code
has theNODE
bit set, then this attempts to skip over the node in theerring_index
- 1 index of the route (erring_index
cannot be 0 in this case: this implies a local node failure). If theNODE
bit is clear, then this attempts to skip over the channel in theerring_index
of the route.This basically just uses
getroute
starting from the node before the failing channel or node, with destination being the node after the failing channel or node. We should use a limited search: if the number of nodes that need to be scanned bygetroute
is too high then we early-out and just fail thepermuteroute
. In addition to the givenexclude
we should also exclude the failing node or channel (double-specifying the same node/channel should be safe).The
msatoshi
andcltv
args ofgetroute
should be copied from the hop that pays to the node after the failing channel/node.If the limited-
max_nodes_scanned
getroute
succeeds, we just conactenate this to the route before the break, then thegetroute
result, then the route after the break. Then callsmoothenroute
on the result.Prerequisites:
getroute
should supportexclude
-ing nodes too #2894getroute
should supportexclude
-ing nodes too.max_nodes_scanned
limiting parameter togetroute
, as described in Permuteroute #2890 (comment)max_nodes_scanned
input forgetroute
, 20 sounds like a good compromise.Usefulness
The text was updated successfully, but these errors were encountered: