Skip to content

Set custom scoring parameters to select shorter routes#16

Merged
amackillop merged 3 commits into
masterfrom
austin_mdk-849_set-scoring-params
May 8, 2026
Merged

Set custom scoring parameters to select shorter routes#16
amackillop merged 3 commits into
masterfrom
austin_mdk-849_set-scoring-params

Conversation

@amackillop
Copy link
Copy Markdown
Contributor

Summary

Bumps ldk-node to pick up tunable scoring params, then applies our
mainnet probabilistic-scorer config and exposes a TOML override
section for in-place tuning.

Commits

  1. 46260dc — Bump ldk-node from
    lsp-0.7.0_socks-support (c3aba2a) to
    lsp-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_kwu accessor (8d956d7), and
    get_max_splice_in_amount accessor (5dce44b). Branches share
    merge base 4309f47. Dev-only ldk-node-lsp pin unchanged.

  2. 636a55d — Apply mainnet probabilistic scorer defaults,
    mirroring mdk-checkout/mdk-config.ts so daemon and mdk-checkout
    agree on routing. Main knob: base_penalty_msat raised to 100x
    the 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.

  3. d89832f[node.scoring] TOML section layers per-field
    overrides 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_params and manual_node_penalties are
    not exposed (matches mdk-checkout; the latter is a
    HashMap<NodeId, u64> that doesn't fit TOML cleanly).

amackillop added 3 commits May 8, 2026 12:15
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.
@amackillop amackillop requested a review from martinsaposnic May 8, 2026 19:34
@amackillop amackillop changed the title Austin mdk 849 set scoring params Set custom scoring parameters to select shorter routes May 8, 2026
@amackillop amackillop merged commit 820f256 into master May 8, 2026
2 checks passed
@amackillop amackillop mentioned this pull request May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants