Set custom scoring parameters to select shorter routes#16
Merged
Conversation
Move from lsp-0.7.0_socks-support (c3aba2a) to lsp-0.7.0_accept-underpaying-htlcs_with_timing_logs (5dce44b). The two branches share a merge base at 4309f47 (disconnect-all-peers). Above that, the old tip carried one SOCKS commit. The new tip carries five: e935695 Upgrade rust-lightning 5baa1f8 Allow setting custom scoring parameters 522b511 Add SOCKS5 proxy support (rebased equivalent of c3aba2a) 8d956d7 Expose channel_funding_fee_sats_per_kwu on Node 5dce44b Add Node::get_max_splice_in_amount accessor So vs the old rev we pick up a rust-lightning bump, tunable ProbabilisticScorer parameters, a channel funding fee accessor, and a splice-in amount accessor. The dev-only ldk-node-lsp pin is unrelated and unchanged.
Mirror the per-network scoring overrides from mdk-checkout mdk-config.ts so the daemon and the JS client agree on routing behavior on mainnet. The main knob is base_penalty_msat raised to 100x the LDK default (1024 -> 102_400 msat), which biases pathfinding toward fewer-hop routes at the cost of paying up to ~102 sat extra per skipped hop. The other ten fields are written out as upstream LDK defaults rather than left to ldk-node's own Default impl. ldk-node is a fork and its defaults could drift; pinning each value here keeps us insulated. If lightning-node ever changes its mainnet values, this is the one place to update. Other networks (signet, regtest, testnet) skip the call and inherit ldk-node's defaults, matching lightning-node's signet config which leaves overrides empty.
Add a `[node.scoring]` TOML section that layers per-field overrides on top of the mainnet baseline. Any omitted field falls through to the baseline; an empty or missing section preserves current behavior. The intent is internal experimentation, not a user-facing knob. We want a single place to point at when tuning scoring on a running node, instead of recompiling. If a value proves out, fold it back into the baseline in `resolve_scoring_params` and remove the override from the operator's config. Tuning only makes sense on mainnet (the public network has the gossip we are biasing against), so on signet/regtest/testnet the baseline doesn't apply and overrides are ignored with a warning. This keeps the scoring code branch-free in the common case and avoids inventing meaningless per-network defaults. Decay parameters and `manual_node_penalties` are deliberately not exposed. lightning-node's mdk-config.ts doesn't expose them either, and `manual_node_penalties` is a HashMap<NodeId, u64> that doesn't map cleanly onto TOML keys. Easy to add later if needed.
martinsaposnic
approved these changes
May 8, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bumps
ldk-nodeto pick up tunable scoring params, then applies ourmainnet probabilistic-scorer config and exposes a TOML override
section for in-place tuning.
Commits
46260dc— Bumpldk-nodefromlsp-0.7.0_socks-support(c3aba2a) tolsp-0.7.0_accept-underpaying-htlcs_with_timing_logs(5dce44b).Picks up rust-lightning bump (
e935695), tunable scorer params(
5baa1f8), rebased SOCKS support (522b511),channel_funding_fee_sats_per_kwuaccessor (8d956d7), andget_max_splice_in_amountaccessor (5dce44b). Branches sharemerge base
4309f47. Dev-onlyldk-node-lsppin unchanged.636a55d— Apply mainnet probabilistic scorer defaults,mirroring
mdk-checkout/mdk-config.tsso daemon and mdk-checkoutagree on routing. Main knob:
base_penalty_msatraised to 100xthe LDK default (1024 → 102_400 msat), biasing pathfinding toward
fewer hops at ~102 sat extra per skipped hop. Other ten fields
pinned to upstream LDK defaults so future ldk-node drift can't
silently change behavior. Non-mainnet networks skip the call.
d89832f—[node.scoring]TOML section layers per-fieldoverrides on top of the mainnet baseline. Internal experimentation
knob, not user-facing. Mainnet-only by design (the baseline is
mainnet-specific and tuning against signet/regtest gossip isn't
meaningful); on other networks a non-empty section is ignored
with a warning.
decay_paramsandmanual_node_penaltiesarenot exposed (matches mdk-checkout; the latter is a
HashMap<NodeId, u64>that doesn't fit TOML cleanly).