core-lightning/plugins
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
..
bkpr Remove update_count from find_account_onchain_fees 2024-02-02 17:31:23 +01:00
clnrest release: Bump pyln package versions 2024-02-28 14:38:10 +01:00
examples cln_plugin : Test default values for ConfigOptions 2024-02-08 15:37:44 +01:00
grpc-plugin cln_plugin: Request value as rust primitive 2024-02-08 15:37:44 +01:00
renepay renepay: update the gossmap after addgossip 2024-02-16 14:51:14 +01:00
spender fundchannel_start & multifundchannel: add channel_type. 2024-01-29 13:40:34 +10:30
src cln_plugin: switch lifetimes of ConfigOption from static to non-static 2024-02-27 13:29:28 +01:00
test plugins/pay: use gossmods_from_listpeerchannels instead of private gossip_store records. 2023-12-14 09:16:56 +10:30
.gitignore Plugins: Add recover plugin which'd identify if we've lost some state and try to recover the node by entering mode. 2024-02-16 22:17:46 +01:00
autoclean.c libplugin: support version strings for deprecations. 2024-01-26 10:30:22 +10:30
bcli.c plugins/bcli: use per-command deprecation flags. 2024-01-26 10:30:22 +10:30
Cargo.toml cln-plugin: Switch from env_logger to tracing-subscriber 2024-01-16 18:36:12 +01:00
chanbackup.c chanbackup: even if they enable experimental-peer-storage, check peers 2023-03-08 18:46:21 -06:00
commando.c commando: use deprecation API for missing ids. 2024-01-26 10:30:22 +10:30
fetchinvoice.c lightningd: remove msatoshi alias for amount_msat. 2024-01-26 10:30:22 +10:30
funder.c funder: don't try to spend emergency_reserve 2024-02-08 06:32:01 +10:30
funder_policy.c libplugin: make set callback for options take plugin ptr, check correct type. 2023-06-20 20:08:25 +09:30
funder_policy.h libplugin: make set callback for options take plugin ptr, check correct type. 2023-06-20 20:08:25 +09:30
keysend.c lightningd: remove msatoshi alias for amount_msat. 2024-01-26 10:30:22 +10:30
libplugin-pay.c common: fix dijkstra scoring. 2024-03-07 14:09:14 +01:00
libplugin-pay.h pay: Prevent repeating the preapproveinvoice check 2024-03-06 11:45:13 +01:00
libplugin.c libplugin: remove global deprecated_apis flag. 2024-01-26 10:30:22 +10:30
libplugin.h libplugin: remove global deprecated_apis flag. 2024-01-26 10:30:22 +10:30
Makefile Plugins: Add recover plugin which'd identify if we've lost some state and try to recover the node by entering mode. 2024-02-16 22:17:46 +01:00
offers.c plugins/offers: Extend the capability of decode to decrypt the contents of emergency.recover file. 2023-10-27 16:05:28 +10:30
offers.h common: update to latest onion message spec. 2022-10-26 11:29:06 +10:30
offers_inv_hook.c lightningd: re-add 'offerout' functionality, as 'invoicerequest'. 2022-11-09 15:08:03 +01:00
offers_inv_hook.h lightningd: re-add 'offerout' functionality, as 'invoicerequest'. 2022-11-09 15:08:03 +01:00
offers_invreq_hook.c offers: fix pay where we are using deprecated apis. 2023-02-03 16:59:51 +01:00
offers_invreq_hook.h offers: create a real blinded path, if necessary. 2022-11-09 15:08:03 +01:00
offers_offer.c lightningd: deprecate @-prefix hack for offer recurrence_base. 2024-02-07 09:21:00 +10:30
offers_offer.h lightningd: re-add 'offerout' functionality, as 'invoicerequest'. 2022-11-09 15:08:03 +01:00
pay.c lightningd: remove msatoshi alias for amount_msat. 2024-01-26 10:30:22 +10:30
README.md doc: fix wording in plugins/README.md 2020-01-06 12:57:59 +01:00
recover.c plugin: Make the recover plugin less noisy 2024-03-06 11:45:39 +01:00
sql.c gossipd: strip private updates from gossip_store on startup. 2024-01-31 14:47:33 +10:30
topology.c gossipd: new routines to support gossmap compatibility. 2024-02-04 09:24:44 +10:30
txprepare.c plugins: remove #if DEVELOPER. 2023-09-21 20:08:24 +09:30

Plugin Directory

Any file in this directory which is executable and whose name only consists of alphanumeric characters, space, '.', '-' or '_' will be automatically loaded when lightningd starts (unless suppressed with commandline options).