Skip to content

Conversation

@elnosh
Copy link
Contributor

@elnosh elnosh commented Jan 27, 2026

Closes #4337

Changes negotiate_anchors_zero_fee_htlc_tx default to true and removes the manually_accept_inbound_channels config option.

Edit: Left the tests with default to non-anchor

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Jan 27, 2026

👋 I see @jkczyz was un-assigned.
If you'd like another reviewer assignment, please click here.

@TheBlueMatt
Copy link
Collaborator

Changing the negotiate_anchors_zero_fee_htlc_tx default to true in the tests causes +100 test failures

Hmm, can you ask claude to change those to use the test_default_config() thing? Our test config default has diverged somewhat from our actual default config for reasons like this but that's okay...

@elnosh elnosh force-pushed the manual-channel-acceptance branch 2 times, most recently from ef441ac to b1ee9e3 Compare January 28, 2026 20:38
@elnosh elnosh marked this pull request as ready for review January 28, 2026 20:38
@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

❌ Patch coverage is 85.05747% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.02%. Comparing base (f43803d) to head (306eea7).
⚠️ Report is 41 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/ln/channelmanager.rs 70.73% 11 Missing and 1 partial ⚠️
lightning/src/ln/functional_test_utils.rs 94.73% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4354   +/-   ##
=======================================
  Coverage   86.01%   86.02%           
=======================================
  Files         156      156           
  Lines      102857   102827   -30     
  Branches   102857   102827   -30     
=======================================
- Hits        88474    88453   -21     
+ Misses      11876    11865   -11     
- Partials     2507     2509    +2     
Flag Coverage Δ
tests 86.02% <85.05%> (+<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.

@jkczyz jkczyz requested a review from wpaulino January 29, 2026 18:32
@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @jkczyz @wpaulino! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

1 similar comment
@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @jkczyz @wpaulino! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot
Copy link

🔔 2nd Reminder

Hey @jkczyz @wpaulino! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@elnosh elnosh force-pushed the manual-channel-acceptance branch from b1ee9e3 to 96719d6 Compare February 3, 2026 00:52
@jkczyz jkczyz removed their request for review February 3, 2026 17:12
@wpaulino
Copy link
Contributor

wpaulino commented Feb 4, 2026

This also needs a rebase

@elnosh elnosh force-pushed the manual-channel-acceptance branch from 96719d6 to daf61b3 Compare February 4, 2026 15:48
@elnosh
Copy link
Contributor Author

elnosh commented Feb 4, 2026

rebased and renamed channel config to default to anchors

@elnosh elnosh force-pushed the manual-channel-acceptance branch from daf61b3 to 927b6c1 Compare February 4, 2026 18:44
@wpaulino
Copy link
Contributor

wpaulino commented Feb 5, 2026

Feel free to squash

When accepting channels manually, it would
fail if the # of peers without funded channels
was == `MAX_UNFUNDED_CHANNEL_PEERS`, however,
it should fail if the # of peers > `MAX_UNFUNDED_CHANNEL_PEERS`.
Removes the `manually_accept_inbound_channels` config
option. In upcoming commit we will default to anchor
channels which requires users checking if they have
enough onchain funds to cover fees in case of a force
close. Hence, we move to always require users to
manually accept inbound channels.
Set `negotiate_anchors_zero_fee_htlc_tx` default
to true.
Now that anchor channels are the default,
rename `test_default_anchors_channel_config` to
`test_default_channel_config` and the
previous default to legacy.
@elnosh elnosh force-pushed the manual-channel-acceptance branch from 927b6c1 to 306eea7 Compare February 5, 2026 22:59
@ldk-reviews-bot
Copy link

✅ Added second reviewer: @valentinewallace

Copy link
Contributor

@valentinewallace valentinewallace left a comment

Choose a reason for hiding this comment

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

Some nits but nothing blocking, feel free to take or leave the feedback for follow-up. Thank you for this update! 🫡

Comment on lines -1226 to -1227
// Assert that `nodes[1]` has no `MessageSendEvent::SendAcceptChannel` in `msg_events` before
// rejecting the inbound channel request.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: isn't this comment still relevant? and below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah it applies but it felt redundant. Can re-add if you prefer.

num_unfunded_channels + peer.inbound_channel_request_by_id.len()
}

#[rustfmt::skip]
Copy link
Contributor

Choose a reason for hiding this comment

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

In the future, we generally prefer to have rustfmt::skip removals in a separate commit, no need to bother for this PR though.

Comment on lines +6367 to 6372
revoked_htlc_txn[0].input[0].previous_output
);
assert_eq!(
node_txn[1].input[1].previous_output,
revoked_htlc_txn[0].input[0].previous_output
revoked_htlc_txn[1].input[0].previous_output
);
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the reason for this diff?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm honestly not quite sure. At some point this was failing and changing them fixed it. This ordering seems correct though?

/// [`Event::OpenChannelRequest`]: crate::events::Event::OpenChannelRequest
/// [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
/// [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
pub manually_accept_inbound_channels: bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

There's still several occurrences of manually_accept in the codebase atm. Not crucial, but I think at least the pending_changelog one should be updated

} else {
let msgs = nodes[1].node.get_and_clear_pending_msg_events();
assert!(msgs.is_empty(), "Expected no message events; got {:?}", msgs);
let events = nodes[1].node.get_and_clear_pending_events();
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I think we can use the new handle_and_accept_open_channel helper here?

/// [`ChannelManager::list_recent_payments`] for more information.
///
/// Routes are automatically found using the [`Router] provided on startup. To fix a route for a
/// Routes are automatically found using the [`Router`] provided on startup. To fix a route for a
Copy link
Contributor

Choose a reason for hiding this comment

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

Nbd, but usually it's not recommended to put unrelated fixes in a commit, even if trivial

let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None, None]);
let legacy_cfg = test_legacy_channel_config();
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg), None, None]);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: pre-existing but only need 2 cfgs here and below

let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let config = test_default_anchors_channel_config();
let config = test_default_channel_config();
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: here and throughout the file's diff, we can just pass in None for the config rather than explicitly setting test_default_channel_config


pub fn test_default_anchors_channel_config() -> UserConfig {
let mut config = test_default_channel_config();
pub fn test_default_channel_config() -> UserConfig {
Copy link
Contributor

Choose a reason for hiding this comment

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

I do wonder if there's an opportunity with these updates to have the default test config match LDK's actual default config. Did you look into how hard that would be? Probably would require too many test updates...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmmm yeah when I tried using the now test_default_channel_config instead of the legacy one, 100+ tests were failing. I didn't go one-by-one in detail but it didn't seem trivial and I think most of them would require specific fixes. Perhaps something for an LLM

@valentinewallace valentinewallace merged commit 7baafe2 into lightningdevkit:main Feb 9, 2026
20 of 21 checks passed
@elnosh elnosh mentioned this pull request Feb 10, 2026
@elnosh
Copy link
Contributor Author

elnosh commented Feb 10, 2026

@valentinewallace sorry for the intermingling of unrelated fixes in some of the commits. Addressed some of the follow-ups here #4407

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.

Move to always-manually-accepting channels (and default anchors)

5 participants