Rusty Russell
ffb324f283
common: fix dijkstra scoring.
...
The "path_score" callback was supposed to evaluate the *entire path*,
but that was counter-intuitive and opened the door to a cost function
bug which caused this path cost to be less than the closer path.
In particular, the capacity bias code didn't understand this at all.
1. Rename the function to `channel_score` and remove the "distance"
parameter (always "1" since you're supposed to be evaluating a
single hop).
2. Rename "cost" to the more specific "fee": "score" is our
actual cost function result (we avoid the word "cost" as it
may get confused with satoshi amounts).
3. For capacity biassing, we do want to know the amount, but
explicitly hand that as a separate parameter "total".
4. Fix a minor bug where total handed to scoring function previously
included channel fee (this is wrong: fee is paid before sending into
channel).
5. Remove the now-unused total_delay member from the dijkstra
struct.
Here are the results of our test now (routing 4194303 msat, which
didn't crash the old code, so we could compare). In both cases
we could find routes to 615 nodes:
Linear success probability (when found): min-max(mean +/- stddev)
Before: 0.484764-0.999750(0.9781+/-0.049)
After: 0.487040-0.999543(0.952548+/-0.075)
Hops:
Before: 1-5(2.13821+/-0.66)
After: 1-5(2.98374+/-0.77)
Fees:
Before: 0-50041(2173.75+/-5.3e+03)
After: 0-50848(922.457+/-2.7e+03)
Delay (blocks):
Before: 0-294(83.1642+/-68)
After: 0-196(65.8081+/-60)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au >
Fixes: https://github.com/ElementsProject/lightning/issues/7092
Changelog-Fixed: Plugins: `pay` would occasionally crash on routing.
Changelog-Fixed: Plugins: `pay` route algorithm fixed and refined to balance fees and capacity far better.
2024-03-07 14:09:14 +01:00
..
2024-03-07 14:09:14 +01:00
2023-07-11 11:41:15 +09:30
2023-07-11 11:41:15 +09:30
2023-11-01 14:11:28 +10:30
2023-11-01 14:11:28 +10:30
2021-11-17 10:51:48 +10:30
2021-11-17 10:51:48 +10:30
2021-12-06 10:05:39 +10:30
2021-11-14 18:49:46 +01:00
2021-11-14 18:49:46 +01:00
2021-12-06 10:05:39 +10:30
2021-09-17 09:43:22 +09:30
2023-05-27 15:06:31 +09:30
2023-05-27 15:06:31 +09:30
2021-02-04 12:02:36 +10:30
2020-09-23 16:30:36 +09:30
2022-09-19 10:18:55 +09:30
2022-09-12 09:34:52 +09:30
2021-12-06 10:05:39 +10:30
2023-04-07 21:22:56 +09:30
2022-11-09 15:08:03 +01:00
2023-04-07 21:22:56 +09:30
2023-01-30 13:24:29 +10:30
2022-04-12 15:17:52 +09:30
2021-12-30 14:36:55 +10:30
2021-07-20 13:28:38 -04:00
2023-10-26 19:11:17 +10:30
2021-01-09 14:34:35 +10:30
2023-12-22 13:10:10 +01:00
2023-09-21 20:08:24 +09:30
2022-11-09 15:08:03 +01:00
2022-10-26 11:29:06 +10:30
2023-09-21 13:31:03 +09:30
2023-09-21 13:31:03 +09:30
2021-12-06 10:05:39 +10:30
2021-10-23 12:59:13 +02:00
2021-12-30 09:50:40 +10:30
2021-12-30 09:50:40 +10:30
2024-01-29 13:40:34 +10:30
2024-01-29 13:40:34 +10:30
2023-07-11 11:41:15 +09:30
2022-03-10 10:22:29 +10:30
2023-08-02 16:12:32 +09:30
2023-08-02 16:12:32 +09:30
2023-07-26 06:55:48 +09:30
2022-07-28 12:08:18 +09:30
2023-09-21 20:08:24 +09:30
2023-09-21 20:08:24 +09:30
2023-09-21 20:08:24 +09:30
2023-06-20 20:08:25 +09:30
2022-01-20 15:24:06 +10:30
2023-09-20 13:56:46 +09:30
2023-06-23 13:12:42 +09:30
2022-07-18 20:50:04 -05:00
2022-07-18 20:50:04 -05:00
2023-10-15 14:01:45 +02:00
2023-09-21 20:08:24 +09:30
2022-05-19 09:47:32 +09:30
2022-05-19 09:47:32 +09:30
2024-01-26 10:30:22 +10:30
2024-01-26 10:30:22 +10:30
2023-09-21 20:08:24 +09:30
2023-09-21 20:08:24 +09:30
2021-12-06 10:05:39 +10:30
2023-11-02 19:32:05 +10:30
2023-11-02 19:32:05 +10:30
2024-03-07 14:09:14 +01:00
2024-03-07 14:09:14 +01:00
2021-12-06 10:05:39 +10:30
2022-09-19 10:18:55 +09:30
2023-08-10 15:52:53 +09:30
2023-08-10 15:52:53 +09:30
2021-12-30 14:36:55 +10:30
2023-09-21 20:08:24 +09:30
2023-01-30 15:15:41 -06:00
2024-02-12 11:43:33 +01:00
2024-03-07 14:09:14 +01:00
2024-02-12 11:43:33 +01:00
2023-12-14 09:16:56 +10:30
2023-12-14 09:16:56 +10:30
2021-12-06 10:05:39 +10:30
2021-12-06 10:05:39 +10:30
2024-01-29 12:02:37 +10:30
2024-01-29 12:02:37 +10:30
2022-07-20 19:28:33 +09:30
2022-03-24 09:53:38 +10:30
2024-02-27 14:04:44 +01:00
2021-12-06 10:05:39 +10:30
2023-06-29 11:28:47 -04:00
2023-06-29 11:28:47 -04:00
2023-06-29 11:28:47 -04:00
2023-06-29 11:28:47 -04:00
2022-10-26 11:29:06 +10:30
2022-10-26 11:29:06 +10:30
2021-09-17 09:43:22 +09:30
2023-11-02 19:32:05 +10:30
2023-07-31 21:00:22 +09:30
2023-06-29 11:28:47 -04:00
2023-06-29 11:28:47 -04:00
2024-02-11 10:46:23 +01:00
2024-02-11 10:46:23 +01:00
2022-11-09 15:08:03 +01:00
2022-11-09 15:08:03 +01:00
2021-12-06 10:05:39 +10:30
2022-11-09 15:08:03 +01:00
2024-01-29 13:40:34 +10:30
2024-01-29 13:40:34 +10:30
2024-01-26 10:30:22 +10:30
2022-11-09 20:25:58 +10:30
2022-11-09 20:25:58 +10:30
2024-02-07 09:21:00 +10:30
2024-01-26 10:30:22 +10:30
2023-07-13 19:34:47 +09:30
2023-07-13 19:34:47 +09:30
2023-07-13 19:34:47 +09:30
2023-07-25 14:47:12 +09:30
2023-11-21 08:23:39 +01:00
2024-01-29 13:40:34 +10:30
2024-02-11 10:46:23 +01:00
2023-03-22 13:50:32 +10:30
2023-03-22 13:50:32 +10:30
2021-12-06 10:05:39 +10:30
2021-09-17 09:43:22 +09:30
2022-06-21 06:52:35 +09:30
2022-06-21 06:52:35 +09:30
2024-01-31 14:47:33 +10:30
2023-10-03 10:05:55 +02:00
2023-10-03 10:05:55 +02:00
2022-01-20 15:24:06 +10:30
2022-01-20 15:24:06 +10:30
2024-01-31 14:47:33 +10:30
2024-01-31 14:47:33 +10:30
2023-09-20 13:56:46 +09:30
2022-11-09 15:08:03 +01:00
2023-09-20 13:56:46 +09:30
2023-04-07 21:22:56 +09:30
2023-01-30 13:24:29 +10:30
2022-10-26 11:29:06 +10:30
2021-12-06 10:05:39 +10:30
2021-07-20 13:28:38 -04:00
2021-12-06 10:05:39 +10:30
2023-10-23 15:48:50 +10:30
2023-10-23 15:48:50 +10:30
2022-01-20 15:24:06 +10:30
2022-01-20 15:24:06 +10:30
2023-10-23 15:48:50 +10:30
2021-09-17 09:43:22 +09:30
2022-02-08 11:15:52 +10:30
2022-02-08 11:15:52 +10:30
2023-03-23 16:10:55 +10:30
2021-12-06 10:05:39 +10:30
2023-09-21 20:08:24 +09:30
2021-10-10 15:32:57 +02:00
2023-12-15 10:20:19 +10:30
2023-07-31 21:00:22 +09:30
2023-07-11 11:41:15 +09:30
2023-07-11 11:41:15 +09:30
2024-02-16 15:02:38 +01:00
2023-03-23 16:10:55 +10:30
2023-08-12 09:24:06 +09:30
2023-08-12 09:24:06 +09:30
2021-12-06 10:05:39 +10:30
2023-10-23 15:48:50 +10:30
2023-10-23 15:48:50 +10:30
2024-03-07 14:09:14 +01:00
2024-03-07 14:09:14 +01:00
2023-06-01 09:28:39 +09:30
2024-01-16 15:47:03 +01:00
2022-12-13 08:28:12 +10:30
2022-12-13 08:28:12 +10:30
2023-09-21 20:08:24 +09:30
2023-09-21 20:08:24 +09:30
2021-12-06 10:05:39 +10:30
2021-12-06 10:05:39 +10:30
2021-09-17 09:43:22 +09:30
2023-10-03 10:05:55 +02:00
2023-10-03 10:05:55 +02:00
2023-09-21 20:08:24 +09:30
2023-09-21 20:08:24 +09:30
2022-01-20 15:24:06 +10:30
2022-01-20 15:24:06 +10:30
2023-12-23 15:19:31 +01:00
2023-12-23 15:19:31 +01:00
2023-02-07 21:03:36 -06:00
2023-02-07 21:03:36 -06:00
2023-09-21 20:08:24 +09:30
2022-10-26 11:29:06 +10:30
2024-02-16 15:02:38 +01:00
2024-02-16 15:02:38 +01:00
2023-06-29 11:28:47 -04:00
2023-06-29 11:28:47 -04:00
2023-06-03 10:50:29 +09:30
2023-06-03 10:50:29 +09:30
2021-12-06 10:05:39 +10:30
2023-01-30 15:15:41 -06:00
2024-02-11 10:46:23 +01:00
2023-10-23 15:48:50 +10:30
2023-06-01 09:28:39 +09:30
2023-09-20 13:56:46 +09:30