Skip to content

signer: Enforce per-payment and on-chain fee budgets - #760

Open
ihordiachenko wants to merge 2 commits into
mainfrom
fix/re-enable-fee-routing-rules
Open

ihordiachenko wants to merge 2 commits into
mainfrom
fix/re-enable-fee-routing-rules

Conversation

@ihordiachenko

@ihordiachenko ihordiachenko commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes: #925.

Routing-balance checks were disabled for amountless invoices, leaving routing fees unenforced. A flat 1,000-sat cap also rejects large trampoline payments because their 0.5% surcharge exceeds it. This change restores enforcement with configurable fee budgets instead of raising max_feerate_per_kw.

A validator wrapper supplies an amount-dependent allowance while VLS accounts for each payment across channels and HTLC parts. This avoids a VLS fork, at the cost of delegation code that must be checked on upgrades. We intend to move this logic into VLS.

Defaults, configurable through SignerConfig::fee_budget_limits and signer CLI flags:

  • Routing: the larger of 1,000 sat and 0.5% of the payment amount, shared across all parts and channels.
  • Commitments and local HTLC transactions: 100,000 sat per new commitment or signed local HTLC input.
  • Mutual closes: 50,000 sat per transaction.

On-chain caps apply independently of policy filters and permissive mode; fee-rate policies remain warnings. Stored commitments remain signable for force-close, with an over-budget warning. Sweeps and withdrawals retain the 150,000 sat/kW ceiling.

Minor related fixes that were blocking testing/implementation:

  • Register invoice-backed sendpay payments synchronously;
  • Recognize direct-invoice xpay
  • Allow amountless-invoice retries with a changed amount after earlier HTLCs clear.
  • Signer errors during invoice and keysend preapproval return payment errors instead of blocking the node;
  • Early checks reject excessive requested fee limits for pay, direct-invoice xpay, and trampoline;
  • SDK send and LNURL pay set matching default limits.

@ihordiachenko
ihordiachenko requested a review from cdecker October 29, 2026 18:08
@ihordiachenko
ihordiachenko marked this pull request as ready for review October 29, 2026 18:14
Restore routing-balance enforcement with the larger of a fixed fee
allowance and a percentage of the payment amount. Keep VLS payment
accounting through a validator wrapper, avoiding a VLS fork.

Enforce absolute commitment, local HTLC, and mutual-close fee caps outside
filterable policies and permissive authentication. Keep stored commitments
signable for force-close and retain the existing sweep feerate ceiling.

Check requested payment fee limits before offering HTLCs, align SDK fee
limits, and register invoice-backed sendpay payments synchronously. Handle
amountless retries and return negative preapproval replies on signer errors
so declined payments do not block the node. Document limits and defaults.
@ihordiachenko
ihordiachenko force-pushed the fix/re-enable-fee-routing-rules branch 2 times, most recently from 59fef56 to 44bfc34 Compare October 29, 2026 20:07

This branch has not been deployed

No deployments
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.

1 participant