-
Notifications
You must be signed in to change notification settings - Fork 403
Start tracking ChannelMonitors by channel ID in ChainMonitor and ChannelManager #3554
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
Start tracking ChannelMonitors by channel ID in ChainMonitor and ChannelManager #3554
Conversation
40aeb66
to
1c7a0a1
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3554 +/- ##
==========================================
- Coverage 88.54% 88.49% -0.05%
==========================================
Files 149 149
Lines 114459 114709 +250
Branches 114459 114709 +250
==========================================
+ Hits 101345 101517 +172
- Misses 10618 10691 +73
- Partials 2496 2501 +5 ☔ View full report in Codecov by Sentry. |
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.
Concept ACK
1c7a0a1
to
850ec1b
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 Still unhappy initializing ChannelManagerReadArgs
in the fuzz test.
850ec1b
to
a24d821
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.
Conceptually LGTM, I think the first two commits make sense, yea. The last commit will obviously have to wait a release or two.
a24d821
to
5bcca97
Compare
Rebased due to conflicts and removed the last commit |
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.
LGTM
5bcca97
to
c680c0f
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.
On real comment, a few nits.
Once dual funding/splicing is supported, channels will no longer maintain their original funding outpoint. Ideally, we identify `ChannelMonitor`s with a stable identifier, such as the channel ID, which is fixed throughout the channel's lifetime. This commit replaces the use of funding outpoints as the key to the monitor index with the channel ID. Note that this is strictly done to the in-memory state; it does not change how we track monitors within their persisted state, they are still keyed by their funding outpoint there. Addressing that is left for follow-up work.
As motivated by the previous commit, we do some of the same work here at the `ChannelManager` level instead. Unfortunately, we still need to track the funding outpoint to support downgrades by writing the in flight monitor updates as two separate TLVs, one using the channel IDs, and the other using the funding outpoints. Once we are willing to stop supporting downgrades past this version, we can fully drop it.
It's not needed except for one place where we can just access the field directly, so we can avoid the allocation on each call. For API consumers, they may still access the funding script via `ChannelMonitor::get_funding_script`.
c680c0f
to
717db82
Compare
Once dual funding/splicing is supported, channels will no longer maintain their original funding outpoint. Ideally, we identify
ChannelMonitor
s with a stable identifier, such as the channel ID, which is fixed throughout the channel's lifetime.In the
ChainMonitor
, we replace the use of funding outpoints as the key to the monitor index with the channel ID. Note that this is strictly done to the in-memory state; it does not change how we track monitors within their persisted state, they are still keyed by their funding outpoint there. Addressing that is left for follow-up work.In the
ChannelManager
, in-flight monitor updates are persisted, so we still need to track the funding outpoint to support downgrades by writing the in them as two separate TLVs, one using the channel IDs, and the other using the funding outpoints. Once we are willing to stop supporting downgrades past this version, we can fully drop the old TLV.Looking to get concept ACKs on whether we want to go down this path. The first two commits can be considered today, but the last one will have to wait a few releases due to the backwards compatibility concern. Note that this PR does not represent all of the work to achieve our goal, there's still a good bit of refactoring/cleanup to follow.