-
Notifications
You must be signed in to change notification settings - Fork 436
Default to anchors and remove automatic channel acceptance #4354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
👋 I see @jkczyz was un-assigned. |
Hmm, can you ask claude to change those to use the |
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.
ef441ac to
b1ee9e3
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4354 +/- ##
=========================================
+ Coverage 0 86.09% +86.09%
=========================================
Files 0 156 +156
Lines 0 102450 +102450
Branches 0 102450 +102450
=========================================
+ Hits 0 88202 +88202
- Misses 0 11754 +11754
- Partials 0 2494 +2494
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1 similar comment
lightning/src/events/mod.rs
Outdated
| /// The `user_channel_id` value passed in for outbound channels, or for inbound | ||
| /// channels. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep this doc consistent with the other events, e.g., SpliceFailed
lightning/src/ln/reorg_tests.rs
Outdated
| features: nodes[0].node.init_features(), networks: None, remote_network_address: None | ||
| }, true).unwrap(); | ||
| } | ||
| let _ = nodes[1].node.get_and_clear_pending_msg_events(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should check what events we're expecting
lightning/src/util/config.rs
Outdated
| /// Note that all inbound channel requests will be surfaced via [`Event::OpenChannelRequest`] | ||
| /// and you must manually accept them with [`ChannelManager::accept_inbound_channel`]. This | ||
| /// is done to give you the chance to check whether your reserve of onchain funds is enough |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// Note that all inbound channel requests will be surfaced via [`Event::OpenChannelRequest`] | |
| /// and you must manually accept them with [`ChannelManager::accept_inbound_channel`]. This | |
| /// is done to give you the chance to check whether your reserve of onchain funds is enough | |
| /// Upon receiving an `[Event::OpenChannelRequest]` for a channel of this type, you must check whether your reserve of onchain funds is enough |
lightning/src/util/config.rs
Outdated
| /// [`ChannelManager::accept_inbound_channel`]. This is done to give you the chance to check | ||
| /// whether your reserve of onchain funds is enough to cover the fees for all existing and new | ||
| /// channels featuring anchor outputs in the event of a force close. | ||
| /// Note that all inbound channel requests will be surfaced via [`Event::OpenChannelRequest`] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same suggestion here as above
| let events = node_b.node.get_and_clear_pending_events(); | ||
| assert_eq!(events.len(), 1); | ||
| match &events[0] { | ||
| Event::OpenChannelRequest { temporary_channel_id, counterparty_node_id, .. } => node_b | ||
| .node | ||
| .accept_inbound_channel(temporary_channel_id, counterparty_node_id, 42, None) | ||
| .unwrap(), | ||
| _ => panic!("Unexpected event"), | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the new helper added here? Several other cases throughout the diff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added use of helper here and below. There were some other places that it is manually checking for an err so I left those.
| // If this peer already has some channels, a new channel won't increase our number of peers | ||
| // with unfunded channels, so as long as we aren't over the maximum number of unfunded | ||
| // channels per-peer we can accept channels from a peer with existing ones. | ||
| if is_only_peer_channel && peers_without_funded_channels >= MAX_UNFUNDED_CHANNEL_PEERS { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed while running this test: https://github.com/elnosh/rust-lightning/blob/813c0146b3149c85111139fa4649a808a32e7217/lightning/src/ln/channel_open_tests.rs#L92-L110 that it would fail to accept the inbound channel if the number of peers without funded channels was == MAX_UNFUNDED_CHANNEL_PEERS but IIUC it should fail to accept it if the # of channels > MAX_UNFUNDED_CHANNEL_PEERS
| let channel_type = channel::channel_type_from_open_channel( | ||
| common_fields, &self.channel_type_features() | ||
| ).map_err(|e| MsgHandleErrInternal::from_chan_no_close(e, common_fields.temporary_channel_id))?; | ||
| let channel_type = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment in line above can be updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ended up removing it since it seems redundant now
|
|
||
| * `ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx` | ||
| now defaults to `true` (previously `false`). This means anchor output channels | ||
| will be negotiated by default for all new channels, requiring users to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| will be negotiated by default for all new channels, requiring users to | |
| will be negotiated by default for all new channels if the counterparty supports it, requiring users to |
| @@ -4555,6 +4555,7 @@ pub fn create_node_cfgs_with_node_id_message_router<'a>( | |||
|
|
|||
| pub fn test_default_channel_config() -> UserConfig { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to have the default actually use anchors so each new test added uses it, and we rename this one to something like legacy_test_channel_config to not break all our existing tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to make sure I understood, you mean renaming the current test_default_channel_config to test_legacy_channel_config and rename test_default_anchors_channel_config to test_default_channel_config and then use test_legacy_channel_config in all the tests that would break if used anchors?
Set `negotiate_anchors_zero_fee_htlc_tx` default to true.
b1ee9e3 to
96719d6
Compare
Closes #4337
Changes
negotiate_anchors_zero_fee_htlc_txdefault to true and removes themanually_accept_inbound_channelsconfig option.Edit: Left the tests with default to non-anchor