-
Notifications
You must be signed in to change notification settings - Fork 402
Add counterparty_node_id & channel_capacity to ChannelClosed event #2387
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
Add counterparty_node_id & channel_capacity to ChannelClosed event #2387
Conversation
04952ca
to
01e3ef1
Compare
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.
Could you add some test coverage? Otherwise LGTM.
@valentinewallace, let me do that and open it up for reviews. |
9be7828
to
ef131e3
Compare
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## main #2387 +/- ##
==========================================
- Coverage 90.34% 90.32% -0.02%
==========================================
Files 106 106
Lines 55784 55850 +66
Branches 55784 55850 +66
==========================================
+ Hits 50398 50447 +49
- Misses 5386 5403 +17
☔ View full report in Codecov by Sentry. |
a54a709
to
ee61e38
Compare
The fix for the CI breakage is merged now so this just needs a rebase :) |
ee61e38
to
1052ac6
Compare
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.
Thanks! Just a few comments.
1052ac6
to
63614a1
Compare
If possible getting the closing txid would be great here too |
@benthecarman in most cases when this event is fired, a closing tx has not yet been confirmed on chain so it is hard to figure out the closing txid at this point. I asked @TheBlueMatt on discord and here is what he had to say about it.
|
lightning/src/ln/channelmanager.rs
Outdated
reason: ClosureReason::ProcessingError { err: err.err.clone() } | ||
reason: ClosureReason::ProcessingError { err: err.err.clone() }, | ||
counterparty_node_id: Some($counterparty_node_id), | ||
channel_capacity_sats: $channel_capacity_sats, |
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.
If we think this may be set to None
sometimes (due to dual funding?) then we should update the docs to indicate when the field can be None
even for users of LDK 0.0.117, if not, let's make the macro take a non-option and wrap it in Some
here so that its a compile error to pass None
.
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.
When might it be considered None
for the dual funding case? If we get a close event before accept_channel2
is sent / received?
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.
Thought so as well. I don’t know if we need worry about that with the new fix. @TheBlueMatt thanks for the pointer to look at the internal object
854b742
to
ca02769
Compare
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.
Looking good. I think you don't need to worry about addressing latest feedback with fixups commits. Can just edit the relevant commits and then we're ready for accept and merge unless any final things caught in review after.
The current ChannelClosed event does not let you know the counterparty during a channel close event. This change adds the counterparty_node_id and the channel_capacity to the ChannelClosed event. This helps users to have more context during a channel close event. Solves lightningdevkit#2343
ca02769
to
7cfafc9
Compare
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.
CI failure unrelated.
LGTM
@@ -755,7 +755,15 @@ pub enum Event { | |||
/// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels | |||
user_channel_id: u128, | |||
/// The reason the channel was closed. | |||
reason: ClosureReason | |||
reason: ClosureReason, | |||
/// Counterparty in the closed channel. |
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.
You have quite a bit of whitespace at the ends of lines in your patch, a local git show
should highlight them for you.
@@ -1655,7 +1655,8 @@ fn do_test_restored_packages_retry(check_old_monitor_retries_after_upgrade: bool | |||
nodes[0].node.force_close_broadcasting_latest_txn(&chan_id, &nodes[1].node.get_our_node_id()).unwrap(); | |||
check_added_monitors(&nodes[0], 1); | |||
check_closed_broadcast(&nodes[0], 1, true); | |||
check_closed_event(&nodes[0], 1, ClosureReason::HolderForceClosed, false); | |||
check_closed_event!(&nodes[0], 1, ClosureReason::HolderForceClosed, false, |
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're trying to move away from the macros slowly towards the functions, please don't re-introduce macro calls where we previously had functions.
The current ChannelClosed event does not let
you know the counterparty during a channel close
event. This change adds the counterparty_node_id
and the channel_capacity to the ChannelClosed event. This helps users to have more context during a
channel close event. Solves #2343