Skip to content

Commit 319b776

Browse files
committed
Expose background probing service
Allow operators to enable either built-in probing strategy through the config file, CLI arguments, or environment variables. Validate strategy settings and document the risk of probes locking outbound liquidity. AI assistance: OpenAI Codex was used to implement and verify this change.
1 parent c03b94f commit 319b776

4 files changed

Lines changed: 404 additions & 0 deletions

File tree

contrib/ldk-server-config.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ alias = "ldk_server" # Lightning node alias
99
#rgs_server_url = "https://rapidsync.lightningdevkit.org/snapshot/v2/" # Optional: RGS URL for rapid gossip sync
1010
#async_payments_role = "client" # Optional async payments role: "client" or "server"
1111

12+
# Background probing service (optional)
13+
# CAUTION: Probes send real HTLCs and can lock outbound liquidity until they time out.
14+
#[probing]
15+
#strategy = "high_degree" # "high_degree" or "random_walk"
16+
#top_node_count = 100 # Required for "high_degree"
17+
#max_hops = 5 # Required for "random_walk"; values below 2 are clamped to 2
18+
#interval_secs = 10 # Time between probe attempts (default: 10 seconds)
19+
#max_locked_msat = 100000000 # Maximum total in-flight probe liquidity (default: 100k sats)
20+
#diversity_penalty_msat = 250 # Optional; useful with "high_degree"
21+
#cooldown_secs = 3600 # Node re-probe cooldown for "high_degree" (default: 1 hour)
22+
1223
# Storage settings
1324
[storage.disk]
1425
dir_path = "/tmp/ldk-server/" # Path for LDK and BDK data persistence, optional, defaults to ~/Library/Application Support/ldk-server/ on macOS, ~/.ldk-server/ on Linux

docs/configuration.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,37 @@ this node to go offline. Set `async_payments_role = "server"` to hold async paym
5959
and onion messages for peers. The server role requires an announceable node configuration.
6060
Leave the field unset to disable async payments.
6161

62+
### `[probing]`
63+
64+
Enables LDK Node's background probing service to train the payment scorer with current
65+
channel-liquidity information. Probing is disabled when this section and the corresponding
66+
CLI/environment options are absent.
67+
68+
Two strategies are available:
69+
70+
- **`"high_degree"`** - probes toward highly connected public nodes. Set
71+
`top_node_count` to control how many top nodes are cycled through.
72+
- **`"random_walk"`** - constructs random paths through the public graph. Set `max_hops`
73+
to limit path length; values below `2` are clamped to `2`.
74+
75+
```toml
76+
[probing]
77+
strategy = "high_degree"
78+
top_node_count = 100
79+
interval_secs = 30
80+
max_locked_msat = 500000
81+
diversity_penalty_msat = 250
82+
cooldown_secs = 3600
83+
```
84+
85+
The optional `interval_secs`, `max_locked_msat`, `diversity_penalty_msat`, and
86+
`cooldown_secs` fields override LDK Node's defaults. `diversity_penalty_msat` and
87+
`cooldown_secs` are useful with `high_degree`; random walks bypass the scorer and do not
88+
track destination cooldowns.
89+
90+
> **Warning:** Probes send real HTLCs over real channels. A probe can remain in flight and
91+
> lock outbound liquidity until its HTLC times out. Set `max_locked_msat` conservatively.
92+
6293
### `[storage.disk]`
6394

6495
Where persistent data is stored. Defaults to `~/.ldk-server/` on Linux and

ldk-server/src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ fn main() {
207207
builder.set_gossip_source_rgs(rgs_server_url);
208208
}
209209

210+
if let Some(probing_config) = config_file.probing_config {
211+
builder.set_probing_config(probing_config);
212+
}
213+
210214
if let Err(e) = builder.set_async_payments_role(config_file.async_payments_role) {
211215
error!("Failed to configure async payments role: {e}");
212216
std::process::exit(-1);

0 commit comments

Comments
 (0)