Commit Graph

485 Commits

Author SHA1 Message Date
Michael Schmoock
cc485256fd drain: make more use format strings 2021-06-17 13:00:58 +02:00
Michael Schmoock
0bd761f7ef drain: fix waitsendpay timeout could have been negative 2021-06-17 13:00:58 +02:00
Michael Schmoock
b602c6ef7d rebalance: fix docstring 2021-06-17 13:00:58 +02:00
Michael Schmoock
0160bb30e0 drain: same getroute default params as rebalance
Limiting at an effective route of len 7 cuts of results
that are less than ~3% likely to succeed.
2021-06-17 13:00:58 +02:00
Michael Schmoock
593fea3de4 drain: fix exclude list and worst_channel direction 2021-06-17 13:00:58 +02:00
Michael Schmoock
775fd8a3c2 rebalance: fix testcase
We changed the return message on `rebalancestop`
in the latest commitm which the testcase did not expect.
2021-06-15 10:41:12 +02:00
Michael Schmoock
b51633889a rebalance: docstring nits 2021-06-15 10:34:45 +02:00
Michael Schmoock
fb9f4688df rebalance: retruns rebalanceall stats on rebalancestop 2021-06-15 10:34:45 +02:00
Gálli Zoltán
132b500c44 getroute_method parameter for rebalance 2021-06-15 09:07:47 +02:00
Gálli Zoltán
2d97b86fcc getroute method name: default->iterative 2021-06-15 09:07:47 +02:00
Gálli Zoltán
fac97fcabc rebalance: interchangeable route search strategy 2021-06-15 09:07:47 +02:00
Michael Schmoock
c36851529c rebalance: code nits 2021-06-08 23:48:59 +02:00
Michael Schmoock
b9c2328400 rebalance: make erring_node count configureable 2021-06-08 23:48:59 +02:00
Michael Schmoock
444c6c41e6 rebalance: switches argument order of retry_for and maxfeepercent
The parameter `maxfeepercent` is rarely changed when using manual rebalances.
However `retry_for` is. Swithcing these parameters gives to option to
easily retry with a higher timeout on the console without naming all
arguments.
2021-06-08 23:48:59 +02:00
Michael Schmoock
309a75b03d rebalance: rebalanceall with maxhops 6 and msatfactor 1 2021-06-08 23:48:59 +02:00
Michael Schmoock
039e972cdf rebalance: fix maxhops iteration 2021-06-08 23:48:59 +02:00
Michael Schmoock
4537b0cdb3 rebalance: renames msat_factor to jsut msatfactor 2021-06-08 23:48:59 +02:00
Michael Schmoock
afcc7b5357 rebalance: make maxhops and msat_factor configureable 2021-06-08 23:48:59 +02:00
Michael Schmoock
0ce0050378 rebalance: trace runtime stats for getroute and sendpay 2021-06-08 23:48:59 +02:00
Michael Schmoock
8989c014f7 rebalance: try short routes and bigger channels first 2021-06-08 23:48:59 +02:00
Michael Schmoock
1b00af4c9b rebalance: reduce and optimize log statements 2021-06-08 23:48:59 +02:00
Michael Schmoock
e9a2a7412f rebalance: improved and fixed error handling 2021-06-08 23:48:59 +02:00
Michael Schmoock
8184a92593 rebalance: fix waitsendpay timeout could have been negative 2021-06-08 23:48:59 +02:00
Michael Schmoock
97707e1daf rebalance: fix getroute parameters
1. use riskfactor of 10 (default of pay) tends to give better routing results
2. limit route max_hops to 5 (+2) tends to give better success rate
2021-06-08 23:48:59 +02:00
Michael Schmoock
5a622072fc rebalance: fix exclude list and worst_channel direction 2021-06-08 23:48:59 +02:00
Christian Decker
6f2b8fb637 paytest: Do not assume the onion is valid 2021-03-25 17:50:25 +01:00
Christian Decker
efd1b7e86a paytest: Fix issue with payments destined for the current node
See previous commit for details.
2021-03-25 17:50:25 +01:00
Christian Decker
fb77c4989b paytest: Reproduce crash reported by m-schmoock on direct payment
We crash the plugin accidentally if we're not handling a paytest but
rather a payment destined for us, due to us falsely assuming the
short-channel-id to be set in the onion

Reported-by: Michael Schmoock <@m-schmoock>
2021-03-25 17:50:25 +01:00
Christian Decker
281e56a5ab gci: Fix missing dependency when building c-lightning 2021-03-25 15:24:45 +01:00
Christian Decker
617a8f6ddd Update submodule plugins to latest version 2021-03-25 15:24:45 +01:00
Christian Decker
4a5f7a0cce probe: Allow the caller to specify the amount to probe
We used to only probe for a 10sat amount, which allows us to test
basic reachability, but it doesn't say much about whether we can
actually pay for something reasonable, so this fixes that.

This may require the following SQL statement to be applied to the
database if you are upgrading from a prior version:

```sql
ALTER TABLE probes ADD amount INTEGER;
```

This is not required if you start with a new database.
2021-03-25 14:47:17 +01:00
Gálli Zoltán
a7a0007dce rebalance: handle HTLC timeout
In rare cases, HTLCs can be stuck for days. I don't know why it's happening, maybe it would worth investigating the situation.
2021-02-26 11:28:07 +01:00
Wladimir J. van der Laan
d59eb41e3f backup: Improve logging configurability for socket server
Add two optional arguments to `backup-cli server`:

- `--log-mode`: either `plain` (simply print the log message) or `systemd`
  (prefix log message with systemd log level, useful for running as a
  a service)

- `--log-level`: minimum level for messages to be logged, from `DEBUG`
  to `CRITICAL`

Also, move some noisy messages to the debug level.
2021-02-26 10:38:22 +01:00
Wladimir J. van der Laan
f66af8d2cf backup: Add section on backup compaction to README 2021-02-26 10:36:29 +01:00
Wladimir J. van der Laan
eada16c688 backup: Add support for Tor
Add support for connecting to the backup server through Tor, via its
SOCKS5 proxy.

See "Usage with Tor" in remote.md for documentation.
2021-02-26 10:35:48 +01:00
Rusty Russell
c8be8a11d7 currencyrate: fix what happens when we get an error.
root@ubuntu-s-4vcpu-8gb-nyc3-01:~# l2-cli currencyrates USD
{
   "code": -32600,
   "message": "Error while processing currencyrates: argument of type 'int' is not iterable",
   "traceback": "Traceback (most recent call last):\n  File \"/usr/local/lib/python3.8/dist-packages/pyln/client/plugin.py\", line 621, in _dispatch_request\n    result = self._exec_func(method.func, request)\n  File \"/usr/local/lib/python3.8/dist-packages/pyln/client/plugin.py\", line 603, in _exec_func\n    return func(*ba.args, **ba.kwargs)\n  File \"/root/plugins/currencyrate/currencyrate.py\", line 121, in currencyrates\n    return get_rates(plugin, currency.upper())\n  File \"/usr/local/lib/python3.8/dist-packages/cachetools/decorators.py\", line 22, in wrapper\n    v = func(*args, **kwargs)\n  File \"/root/plugins/currencyrate/currencyrate.py\", line 110, in get_rates\n    r = get_currencyrate(plugin, currency, s.urlformat, s.replymembers)\n  File \"/root/plugins/currencyrate/currencyrate.py\", line 71, in get_currencyrate\n    r = requests_retry_session(retries=5, status_forcelist=(404)).get(url, proxies=plugin.proxies)\n  File \"/usr/lib/python3/dist-packages/requests/sessions.py\", line 543, in get\n    return self.request('GET', url, **kwargs)\n  File \"/usr/lib/python3/dist-packages/requests/sessions.py\", line 530, in request\n    resp = self.send(prep, **send_kwargs)\n  File \"/usr/lib/python3/dist-packages/requests/sessions.py\", line 643, in send\n    r = adapter.send(request, **kwargs)\n  File \"/usr/lib/python3/dist-packages/requests/adapters.py\", line 439, in send\n    resp = conn.urlopen(\n  File \"/usr/lib/python3/dist-packages/urllib3/connectionpool.py\", line 803, in urlopen\n    if retries.is_retry(method, response.status, has_retry_after):\n  File \"/usr/lib/python3/dist-packages/urllib3/util/retry.py\", line 339, in is_retry\n    if self.status_forcelist and status_code in self.status_forcelist:\nTypeError: argument of type 'int' is not iterable\n"
}

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-02-17 07:37:20 +01:00
Gálli Zoltán
38b03cdddc rebalance: channel wo scid
A channel can exist without a short_channel_id, in the CHANNELD_AWAITING_LOCKIN state, while the funding transaction is sent but not yet included in a block.

Running `rebalanceall` while opening a channel could throw an exception:
```
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py: Exception in thread Thread-5:
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py: Traceback (most recent call last):
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py:   File \"/usr/lib/python3.6/threading.py\", line 916, in _bootstrap_inner
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py:     self.run()
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py:   File \"/usr/lib/python3.6/threading.py\", line 864, in run
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py:     self._target(*self._args, **self._kwargs)
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py:   File \"/home/user/plugins/rebalance/rebalance.py\", line 475, in rebalanceall_thread
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py:     result = maybe_rebalance_once(plugin, failed_pairs)
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py:   File \"/home/user/plugins/rebalance/rebalance.py\", line 443, in maybe_rebalance_once
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py:     result = maybe_rebalance_pairs(plugin, ch1, ch2, failed_pairs)
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py:   File \"/home/user/plugins/rebalance/rebalance.py\", line 425, in maybe_rebalance_pairs
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py:     wait_for_htlcs(plugin, [scid1, scid2])
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py:   File \"/home/user/plugins/rebalance/rebalance.py\", line 384, in wait_for_htlcs
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py:     if scids is not None and channel['short_channel_id'] not in scids:
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py: KeyError: 'short_channel_id'
```
2021-02-16 10:58:35 +01:00
Antoine Poinsot
04eed3f595 Introduce a Minimum Supported Python Version for Python plugins
Fixes https://github.com/lightningd/plugins/issues/146

Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2021-02-11 13:31:50 +01:00
Antoine Poinsot
3923bc787f README: touch on starting plugins via RPC, and two nits
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2021-02-11 13:31:50 +01:00
Christian Decker
3be58b2580 paytest: Add description of the paytest protocol 2021-02-11 13:29:37 +01:00
Christian Decker
dc070e8e90 paytest: Create a new plugin to test pay implementations 2021-02-11 13:29:37 +01:00
Aido
defdc28915 summary: Add fees_collected info to output 2021-02-10 15:36:52 +01:00
Christian Decker
139ea7de14 prometheus: Update the pyln-client dependency
Reported-By: <@zefir01>
2021-02-08 18:23:23 +01:00
Gálli Zoltán
d219c0abc1 rebalance: measure and log HTLC settlement time
log messages show how much time need for an HTLC settlement
2021-02-08 14:57:27 +01:00
Wladimir J. van der Laan
cdfcd5a2fe backup: Add support for IPv6 addresses in socket backend
Support the bracketed `socket:[::]:1234` syntax for IPv6 addresses.

Also, add factor out the socket URI parsing to a function and add
tests for it. As a forward compatibility measure, reject query strings
(`?a=b`) because I intend to use these for parameters such as SOCKS5
proxy (for Tor) in a future patch.
2021-02-08 10:31:28 +01:00
Peter Sebastian Nordholt
ca75d7e132 Fix string formating. 2021-02-05 09:05:16 +01:00
Peter Sebastian Nordholt
63232c0fb2 Fix handling of ignored messages in historian.py
Fixes a bug where gossip messages that are ignored by the historian plugin will trigger an exception being printed.
2021-02-05 09:05:16 +01:00
Michael Schmoock
c277f9e10b rebalance: adds a check for no incoming liquidity 2021-02-04 14:54:37 +01:00
Wladimir J. van der Laan
be140a72f7 backup: Use dummy backend in test_rewrite
Additional checking was added that a file exists when `create=False`,
this runs into an error with the `test_rewrite()` test. Update the test
to use dummy backend for the test, as it tests a method on the base
class, not any specific backend.
2021-02-04 13:06:41 +01:00
Wladimir J. van der Laan
7819fef71e backup: Update README for --lightning-dir argument 2021-02-04 13:06:41 +01:00