Skip to content

Expose anchor per-channel reserve in node config - #322

Merged
benthecarman merged 1 commit into
lightningdevkit:mainfrom
frnandu:frnandu/expose-anchor-per-channel-reserve-in-node-config
Oct 29, 2026
Merged

benthecarman merged 1 commit into
lightningdevkit:mainfrom
frnandu:frnandu/expose-anchor-per-channel-reserve-in-node-config

Conversation

@frnandu

@frnandu frnandu commented Oct 29, 2026

Copy link
Copy Markdown

Closes #321.

Problem

ldk-node defaults AnchorChannelsConfig::per_channel_reserve_sats to 25,000 sats, but ldk-server did not expose that field. A node with no spendable on-chain balance therefore rejected every inbound anchor channel, including an LSP-funded one:

Rejecting inbound Anchor channel from peer ... due to insufficient available on-chain reserves. Available: 0/25000sats

This blocks an initial LSPS1 channel purchase or LSPS2 JIT channel for wallets designed to receive before depositing on-chain bitcoin.

Change

  • Add node.anchor_per_channel_reserve_sats (TOML), --node-anchor-per-channel-reserve-sats (CLI) and LDK_SERVER_NODE_ANCHOR_PER_CHANNEL_RESERVE_SATS (env).
  • Wire it into ldk_node_config.anchor_channels_config.per_channel_reserve_sats.
  • Keep the current 25,000 sat default when unset, matching LDK Node.
  • 0 permits inbound anchor channels with zero on-chain balance while leaving LDK's fee-bump handling enabled if funds become available later.

Security note

A zero or very low reserve raises risk if a channel needs an urgent close while the wallet has no on-chain funds: the node may be unable to increase the closing transaction fee until the on-chain wallet is funded. This is documented in docs/configuration.md with an explicit warning, and in the annotated config template.

This is distinct from trusted_peers_no_reserve, which additionally tells LDK to rely on the peer to confirm channel-closing transactions, and from enable_zero_fee_commitments.

Tests

  • test_accepts_anchor_per_channel_reserve_arg covers CLI parsing (0 and non-zero).
  • test_anchor_per_channel_reserve_defaults_to_25k_sats covers the 25,000 sat default when unset.
  • Existing file/args precedence tests updated to cover the new field.

cargo test -p ldk-server passes (141 tests), and cargo fmt --all /
cargo fmt --manifest-path e2e-tests/Cargo.toml --all were run.

AI tools were used to help write this change and its tests.

@ldk-reviews-bot

ldk-reviews-bot commented Oct 29, 2026 •

Copy link
Copy Markdown

I've assigned @benthecarman as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

Comment thread ldk-server/src/util/config.rs
Comment thread docs/configuration.md Outdated
Comment thread docs/configuration.md
Comment thread docs/configuration.md Outdated
Comment thread ldk-server/src/util/config.rs Outdated
ldk-node defaults AnchorChannelsConfig::per_channel_reserve_sats to
25,000 sats, but ldk-server did not expose the setting. A node with no
spendable on-chain balance therefore rejected every inbound anchor
channel, including LSP-funded LSPS1 and LSPS2 channels, which blocks
wallets designed to receive before depositing on-chain bitcoin.

Add node.anchor_per_channel_reserve_sats, wired into
ldk_node_config.anchor_channels_config.per_channel_reserve_sats, plus
the matching --node-anchor-per-channel-reserve-sats CLI flag and
LDK_SERVER_NODE_ANCHOR_PER_CHANNEL_RESERVE_SATS environment variable.
Unset keeps the 25,000 sat default (AnchorChannelsConfig::default()
per_channel_reserve_sats). Setting 0 accepts inbound anchor channels
with no on-chain balance while leaving LDK's fee-bump handling enabled
if funds arrive later.

Document the security tradeoff: a zero or very low reserve can leave
the node unable to fee-bump an urgent channel close until the on-chain
wallet is funded. This is distinct from trusted_peers_no_reserve, which
also makes LDK rely on the peer to confirm closing transactions. Note
that trusted_peers_no_reserve is not currently configurable in LDK
Server.

The anchor reserve default test builds its TOML with
lsps2_service_config_for_feature() so the feature-independent default is
verified with and without experimental-lsps2-support.

AI tools were used to help write this change and its tests.
@frnandu
frnandu force-pushed the frnandu/expose-anchor-per-channel-reserve-in-node-config branch from f0d14cb to b9a0364 Compare October 29, 2026 16:35

@benthecarman benthecarman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK b9a0364

@benthecarman
benthecarman merged commit 590cdd9 into lightningdevkit:main Oct 29, 2026
10 checks passed
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.

Expose anchor per-channel reserve in node configuration

3 participants