-
Notifications
You must be signed in to change notification settings - Fork 411
Require counterparty_node_id TLV for ChannelMonitor #3638
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
Require counterparty_node_id TLV for ChannelMonitor #3638
Conversation
👋 Thanks for assigning @jkczyz as a reviewer! |
d7cd76e
to
027b2ea
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3638 +/- ##
==========================================
- Coverage 89.22% 89.19% -0.03%
==========================================
Files 155 155
Lines 119246 119089 -157
Branches 119246 119089 -157
==========================================
- Hits 106394 106220 -174
- Misses 10260 10277 +17
Partials 2592 2592 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
d5f5469
to
fc4ee83
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.
All looks fairly straightforward. Anything that I noticed was addressed in later commits. Could you add a pending changelog file indicating the compatibility changes?
👋 The first review has been submitted! Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer. |
fc4ee83
to
7063531
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.
one comment otherwise lgtm
7063531
to
caace0c
Compare
Had to rebase after #3594 and it was a bit annoying, please re-review. I also restored |
🔔 1st Reminder Hey @TheBlueMatt @jkczyz! This PR has been waiting for your review. |
caace0c
to
5db6b24
Compare
New `ChannelMonitor`s created starting from v0.0.110 will already have this field set, and those created before then will have it set if a `ChannelMonitorUpdate` created in v0.0.116 or later has been applied. It would be extremely rare for a user to not fall under either of these conditions: they opened a channel almost 3 years ago, and haven't had any activity on it in the last 2 years. Nonetheless, a panic has been added on `ChannelMonitor` deserialization to ensure users can move forward by first running a v0.1.* release and sending/routing a payment or closing the channel before upgrading to v0.2.0.
Now that we require `ChannelMonitor`s to track the channel's counterparty node ID, we can remove the `outpoint_to_peer` map that was used throughout `MonitorEvent` handling. This is a big win for a post-splicing future, as we'll no longer have to bother updating this map when a splice is proposed. Some existing tests providing coverage have been removed as a result.
The `counterparty_node_id` in `ChannelMonitorUpdate`s was only tracked to guarantee we could backfill the `ChannelMonitor`'s field once the update is applied. Now that we require the field to already be set at the monitor level, we can remove it from the updates without backwards compatibility concerns as it was written as an odd TLV.
5db6b24
to
fa4ff0c
Compare
Had to rebase again due to a minor conflict |
"temporary_channel_id should be set since unset_funding_info is only called on funded \ | ||
channels that were unfunded immediately beforehand" |
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.
Eh, will need to update this message, I guess.
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 think it's still correct-ish? The OutboundV1Channel
was funded, it just hadn't transitioned to FundedChannel
yet.
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.
Ah, fair enough!
@@ -0,0 +1,5 @@ | |||
## API Updates (0.2) | |||
|
|||
* Upgrading to v0.2.0 is not allowed when a `ChannelMonitor` that does not track the channel's |
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.
This isnt particularly useful information for a user. How do they know what channelmonitors track the channel's node id vs not? We should list the exact reasons (monitors created before version X that have had no updates since version Y) instead.
assert!(err_msg.contains("An existing channel using ID")); | ||
assert!(err_msg.contains("is open with peer")); | ||
let channel_id = ChannelId::v1_from_funding_outpoint(funding_output); | ||
let reason = ClosureReason::ProcessingError { err: format!("An existing channel using ID {} is open with peer {}", channel_id, nodes[1].node.get_our_node_id()), }; |
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 really need a copy of this test for v2 channel opens @dunxen
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, tracking it.
New
ChannelMonitor
s created starting from v0.0.110 will already have this field set, and those created before then will have it set if aChannelMonitorUpdate
created in v0.0.116 or later has been applied.It would be extremely rare for a user to not fall under either of these conditions: they opened a channel almost 3 years ago, and haven't had any activity on it in the last 2 years. Nonetheless, a panic has been added on
ChannelMonitor
deserialization to ensure users can move forward by first running a v0.1.* release and sending/routing a payment or closing the channel before upgrading to v0.2.0.As a result, the
ChannelManager::outpoint_to_peer
map can now be dropped.