Skip to content

Add unannounced_channel_max_inbound_htlc_value_in_flight_percentage#4529

Merged
TheBlueMatt merged 1 commit intolightningdevkit:mainfrom
tankyleo:2026-04-add-max-inflight-knob-for-unannounced-channels
Apr 2, 2026
Merged

Add unannounced_channel_max_inbound_htlc_value_in_flight_percentage#4529
TheBlueMatt merged 1 commit intolightningdevkit:mainfrom
tankyleo:2026-04-add-max-inflight-knob-for-unannounced-channels

Conversation

@tankyleo
Copy link
Copy Markdown
Contributor

@tankyleo tankyleo commented Apr 1, 2026

    Add `unannounced_channel_max_inbound_htlc_value_in_flight_percentage`

    Users can now configure two different max percentages for the channel
    value that can be allocated to inbound HTLCs, one for announced
    channels, and another for unannounced channels.

    We also bump the default maximums to 25% for announced channels, and
    100% for unannounced channels, to bring them closer to what people would
    expect.

@ldk-reviews-bot
Copy link
Copy Markdown

ldk-reviews-bot commented Apr 1, 2026

👋 Thanks for assigning @TheBlueMatt 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.

@tankyleo tankyleo requested a review from TheBlueMatt April 1, 2026 06:37
@ldk-claude-review-bot
Copy link
Copy Markdown
Collaborator

ldk-claude-review-bot commented Apr 1, 2026

No issues found. All three items from the previous review have been addressed:

  1. Deserialization backward compatibility — Fixed. Both write (channel.rs:15713) and read (channel.rs:16151) paths now use get_legacy_default_holder_max_htlc_value_in_flight_msat() which hardcodes MAX_IN_FLIGHT_PERCENT_LEGACY = 10.

  2. Missing test coverage for announced path — Fixed. test_configured_holder_max_htlc_value_in_flight now calls the helper with both true and false.

  3. Doc default value — Fixed. announced_channel_max_inbound_htlc_value_in_flight_percentage doc now correctly states "Default value: 25".

I verified all test changes use the correct field (announced_* vs unannounced_*) matching the channel type in each test. The fuzzing Readable impl correctly maps a single byte to both fields. The ChannelHandshakeConfigUpdate::apply handles both fields correctly.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

❌ Patch coverage is 93.58974% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.10%. Comparing base (450c03a) to head (2867d5c).
⚠️ Report is 14 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/util/config.rs 75.00% 3 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4529      +/-   ##
==========================================
- Coverage   87.10%   87.10%   -0.01%     
==========================================
  Files         163      163              
  Lines      108740   108856     +116     
  Branches   108740   108856     +116     
==========================================
+ Hits        94723    94817      +94     
- Misses      11531    11550      +19     
- Partials     2486     2489       +3     
Flag Coverage Δ
fuzzing 40.21% <65.71%> (+0.01%) ⬆️
tests 86.21% <95.65%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tankyleo tankyleo force-pushed the 2026-04-add-max-inflight-knob-for-unannounced-channels branch 2 times, most recently from 887ca41 to 3644da0 Compare April 1, 2026 08:40
/// See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
/// for more information.
///
/// Default value: `25`
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.

Let's definitely default to 100.

our_htlc_minimum_msat: Readable::read(reader)?,
max_inbound_htlc_value_in_flight_percent_of_channel: Readable::read(reader)?,
announced_channel_max_inbound_htlc_value_in_flight_percentage: Readable::read(reader)?,
unannounced_channel_max_inbound_htlc_value_in_flight_percentage: Readable::read(
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.

nit; i dont think its worth reading a separate value here, just copy the one from the announced field so we don't end up invalidating existing fuzz corpuses.

@tankyleo tankyleo requested a review from TheBlueMatt April 2, 2026 16:38
@tankyleo
Copy link
Copy Markdown
Contributor Author

tankyleo commented Apr 2, 2026

@benthecarman @tnull a heads up we are revisiting some defaults here

@tnull tnull self-requested a review April 2, 2026 16:41
@tankyleo tankyleo self-assigned this Apr 2, 2026
@tankyleo tankyleo moved this to Goal: Merge in Weekly Goals Apr 2, 2026
@TheBlueMatt
Copy link
Copy Markdown
Collaborator

Feel free to squash.

Copy link
Copy Markdown
Contributor

@benthecarman benthecarman left a comment

Choose a reason for hiding this comment

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

concept ack for sure!

// Set the percentage to the default value at the time this test was written
config.channel_handshake_config.announced_channel_max_inbound_htlc_value_in_flight_percentage =
10;
let configs = [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: I think you can do let configs: [Option<Config>; 9] = std::array::from_fn(|_| Some(config.clone())); to clean this up

@TheBlueMatt TheBlueMatt removed their request for review April 2, 2026 18:13
@tankyleo tankyleo force-pushed the 2026-04-add-max-inflight-knob-for-unannounced-channels branch from a0e4183 to e12945f Compare April 2, 2026 18:27
@tankyleo
Copy link
Copy Markdown
Contributor Author

tankyleo commented Apr 2, 2026

Squashed with from_fn cleanups in the tests.

@tankyleo tankyleo requested a review from TheBlueMatt April 2, 2026 18:30
@tankyleo tankyleo added this to the 0.3 milestone Apr 2, 2026
Users can now configure two different max percentages for the channel
value that can be allocated to inbound HTLCs, one for announced
channels, and another for unannounced channels.

We also bump the default maximums to 25% for announced channels, and
100% for unannounced channels, to bring them closer to what people would
expect.
@tankyleo tankyleo force-pushed the 2026-04-add-max-inflight-knob-for-unannounced-channels branch from e12945f to 2867d5c Compare April 2, 2026 18:37
@TheBlueMatt TheBlueMatt merged commit 369a2cf into lightningdevkit:main Apr 2, 2026
18 of 19 checks passed
@github-project-automation github-project-automation bot moved this from Goal: Merge to Done in Weekly Goals Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants