Antoine Poinsot
a155107857
jitrebalance: don't set result twice when we can't have a reverse chan
...
This also moves all logs to get_circular_route, as we have two ways of
returning None.
Signed-off-by: Antoine Poinsot <darosior@protonmail.com >
2020-06-02 11:59:12 +02:00
Antoine Poinsot
4fb91a6f45
jitrebalance: test failure cases
...
Signed-off-by: Antoine Poinsot <darosior@protonmail.com >
2020-06-02 11:59:12 +02:00
Antoine Poinsot
afebc21401
jitrebalance: if target scid errors, game is over
...
Signed-off-by: Antoine Poinsot <darosior@protonmail.com >
2020-06-02 11:59:12 +02:00
Antoine Poinsot
c5c24cb74a
jitrebalance: assert l2 jit-rebalanced in test_simple_rebalance
...
Signed-off-by: Antoine Poinsot <darosior@protonmail.com >
2020-06-02 11:59:12 +02:00
Antoine Poinsot
e239fcdcc1
jitrebalance: test_issue_88 needs DEVELOPER too
...
Signed-off-by: Antoine Poinsot <darosior@protonmail.com >
2020-06-02 11:59:12 +02:00
Antoine Poinsot
815c382855
jitrebalance: use waitsendpay to wait for htlc resolution
...
This is a rebalance we initiated, so it's our payment
Signed-off-by: Antoine Poinsot <darosior@protonmail.com >
2020-06-02 11:59:12 +02:00
Antoine Poinsot
e11fe21dcb
jitrebalance: add a configurable timeout to stop trying to rebalance
...
Signed-off-by: Antoine Poinsot <darosior@protonmail.com >
2020-06-02 11:59:12 +02:00
Antoine Poinsot
7d900c952b
jitrebalance: log on success, don't log the onion
...
Signed-off-by: Antoine Poinsot <darosior@protonmail.com >
2020-06-02 11:59:12 +02:00
Antoine Poinsot
61c97e11ef
jitrebalance: try as much routes as possible; don't stop at 5
...
Signed-off-by: Antoine Poinsot <darosior@protonmail.com >
2020-06-02 11:59:12 +02:00
Antoine Poinsot
bee26113c0
jitrebalance: don't assume that 'listchannels' results contains 2 entries
...
Signed-off-by: Antoine Poinsot <darosior@protonmail.com >
2020-05-27 14:51:28 +02:00
Antoine Poinsot
386d4eaa6d
jitrebalance: handle the absence of the 'erring_channel' field
...
On failed 'sendpay'.
Signed-off-by: Antoine Poinsot <darosior@protonmail.com >
2020-05-27 14:51:28 +02:00
Antoine Poinsot
18632df38c
jitrebalance: add the direction of erring channel on failed sendpay
...
Signed-off-by: Antoine Poinsot <darosior@protonmail.com >
2020-05-27 14:51:28 +02:00
Christian Decker
d34cb6e637
jitrebalance: Do not attempt to access scid on unconfirmed channels
...
Fixes #88
2020-05-27 12:34:57 +02:00
Christian Decker
9ebc175542
jitrebalance: Fix error when computing negative msat amounts
2020-05-27 12:34:57 +02:00
Christian Decker
18d03962df
jitrebalance: Add a test to reproduce issue #88
...
I'm expecting it to be because we access the short_channel_id
indiscriminately, which is unsafe if the channel is not confirmed yet, i.e.,
it doesn't have a scid yet.
2020-05-27 12:34:57 +02:00
Christian Decker
ea8e24eb56
fixup! jitrebalance: First version of the JITrebalance plugin
2020-01-07 21:21:11 +01:00
Christian Decker
504d15bfbf
jitrebalance: Refactor code and implement retry logic
2020-01-07 21:21:11 +01:00
Christian Decker
9ef45ae83c
jitrebalance: Skip tests if not developer, gossip is too slow
2020-01-07 21:21:11 +01:00
Christian Decker
7479c342c4
jitrebalance: Make the plugin TLV compatible
2020-01-07 21:21:11 +01:00
Christian Decker
c453e8982f
jitrebalance: First version of the JITrebalance plugin
...
A simple implementation of a jit-rebalance plugin based in the idea of
@renepickhardt. Upon receiving an HTLC that we are supposed to forward check
whether the channel has sufficient capacity to forward. If that's not the case
we need to rebalance. For this we compute a circular route through some other
nodes, returning funds on the edge we are supposed to use when
forwarding. This means we rebalance the channel just enough to make forwarding
possible.
This only implements the simple version, without FOAF advertisements of free
rebalancings, but it already works rather nicely.
Suggested-by: Rene Pickhardt <@renepickhardt>
Signed-off-by: Christian Decker <@cdecker>
2020-01-07 21:21:11 +01:00