Commit Graph

62 Commits

Author SHA1 Message Date
Gálli Zoltán
267a464293 rebalance report: fee as ppm 2021-06-17 13:31:13 +02:00
Gálli Zoltán
924a59fc6e rebalance report 2021-06-17 13:31:13 +02:00
Michael Schmoock
b602c6ef7d rebalance: fix docstring 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
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
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
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
Michael Schmoock
c277f9e10b rebalance: adds a check for no incoming liquidity 2021-02-04 14:54:37 +01:00
Michael Schmoock
5555c73208 rebalance: test a full rebalanceall run 2021-02-03 14:17:20 +01:00
Michael Schmoock
5231bfff65 rebalance: speedup by checking for htlcs 2021-02-03 14:17:20 +01:00
Michael Schmoock
cf9b942966 rebalance: fix potential looping mistakes 2021-02-03 14:17:20 +01:00
Michael Schmoock
5e00474390 rebalance: test rebalanceall starts without errors 2021-02-03 14:17:20 +01:00
Michael Schmoock
c6c44aca8e rebalance: test manaual rebalancing 2021-02-03 14:17:20 +01:00
Michael Schmoock
f55df28bcd rebalance: adds a very basic rebalanceall test 2021-02-03 14:17:20 +01:00
Michael Schmoock
239a21ab6b rebalance: autofix code nits 2021-02-03 14:17:20 +01:00
Michael Schmoock
3cbe497976 rebalance: fix division by zero 2021-02-03 14:17:20 +01:00
Michael Schmoock
92aafe7404 chore: rename feeadjustertoggle to feeadjuster-toggle 2021-01-19 12:17:30 +01:00
Gálli Zoltán
b80c558ebd rebalance: better feeadjuster integration
- turns off feeadjuster's automatic fee updates while rebalance running
- runs feeadjust only once, at the end
- measures time for rebalance
2021-01-19 10:23:34 +01:00
Gálli Zoltán
03e599678b automatic rebalance: review fixes part 4
- even more Millisatoshi usage
- nit fixes
2020-12-14 21:01:18 +01:00
Gálli Zoltán
21aaa6e4f3 automatic rebalance: review fixes part 3
- better thread handling
- more Millisatoshi usage
2020-12-14 21:01:18 +01:00
Gálli Zoltán
e2ed65e187 automatic rebalance: review fixes part 2 2020-12-14 21:01:18 +01:00
Gálli Zoltán
06d771539d automatic rebalance: review fixes 2020-12-14 21:01:18 +01:00
Gálli Zoltán
0dee5017b3 automatic rebalance
- rebalances liquidity between channels through circular payments
- automatically selects appropriate channels and executes rebalance
- uses economic fee by default: the rebalance transaction fees are less than the node's default fee, so it is cheaper to fix the liquidity than it can be ruined by transaction forwards
- runs async in the background, sometimes for a very long time (maybe hours)
- tries to rebalance small channels to a 50/50 liquidity ratio and stores remaining liquidity in big channels
- does nothing if there is no cheap enough circular route for rebalance
2020-12-14 21:01:18 +01:00
Michael Schmoock
4cb12a41cd rebalance: reduce some log output to debug 2020-06-11 13:16:01 +02:00
Christian Decker
c6e3b9f011 pytest: Rename start tests to reflect the plugin under test 2019-12-27 17:17:58 +01:00
darosior
e574a717b1 Add pyln-client requirement to all plugins 2019-12-27 17:17:58 +01:00
darosior
9a9f95c6d1 rebalance: add basic tests 2019-12-19 14:36:20 +01:00
darosior
94c641ea58 rebalance: restore Python3.5 compat
Support old snakes that have not shed yet
2019-09-06 17:26:23 +02:00
Matt Whitlock
477bdd8f61 rebalance: round HTLC fees up
BOLT#7 requires that nodes "SHOULD accept HTLCs that pay a fee equal to or greater than:
fee_base_msat + ( amount_to_forward * fee_proportional_millionths / 1000000 )".

The code in rebalance.py:setup_routing_fees was not strictly meeting the above requirement, as it was using truncating integer division to calculate the proportional part of the fee, which typically results in a fee that is strictly less than the theoretical, infinite-precision, required fee. Some node implementations may allow rounding down here, but some do not, resulting in sporadic WIRE_FEE_INSUFFICIENT errors.

This commit changes the fee calculation in setup_routing_fees so that it always rounds up to the next whole millisatoshi, thereby eliminating many WIRE_FEE_INSUFFICIENT errors and improving the success rate of the rebalance command.
2019-08-29 14:13:57 +02:00
Michael Schmoock
cd1b751f53 rebalance: fix route direction
This will set the correct `direction` on manual route hops (in/out).
Before this was not set, resulting in WIRE_FEE_INSUFFICIENT errors,
if fee was calcualted inconsistently with `direction`.
2019-06-11 15:56:36 +02:00
Michael Schmoock
300b963c9d rebalance: fix amount None 2019-06-03 19:26:26 +02:00