-
Notifications
You must be signed in to change notification settings - Fork 417
Broadcast holder commitment for currently confirmed funding #3939
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
Broadcast holder commitment for currently confirmed funding #3939
Conversation
👋 Thanks for assigning @jkczyz as a reviewer! |
a783444
to
a8ae4b7
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3939 +/- ##
==========================================
- Coverage 88.93% 88.76% -0.18%
==========================================
Files 174 173 -1
Lines 123842 124326 +484
Branches 123842 124326 +484
==========================================
+ Hits 110142 110357 +215
- Misses 11254 11553 +299
+ Partials 2446 2416 -30
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:
|
🔔 1st Reminder Hey @TheBlueMatt! This PR has been waiting for your review. |
👋 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. |
a8ae4b7
to
86b53fa
Compare
86b53fa
to
48629c7
Compare
48629c7
to
60d97d0
Compare
🔔 1st Reminder Hey @jkczyz! This PR has been waiting for your review. |
🔔 2nd Reminder Hey @jkczyz! This PR has been waiting for your review. |
582ad71
to
511fdc8
Compare
🔔 3rd Reminder Hey @jkczyz! This PR has been waiting for your review. |
debug_assert!(self.alternative_funding_confirmed.is_none()); | ||
self | ||
.pending_funding | ||
.drain(..) |
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 looks like it needs to handle multiple incomplete 0conf fundings too, though - we can accept one 0conf splice then another before either confirm, or accept another after the first only has 1 conf. We'd need to handle that here by only dropping some fundings...
I kinda feel like we should just drop the last commit and do it later, rather than trying to support it right now.
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 right, the key aspect here is that the zero conf splices chain upon one another, unlike RBFs.
511fdc8
to
9051703
Compare
9051703
to
919b1d8
Compare
🔔 4th Reminder Hey @TheBlueMatt @jkczyz! This PR has been waiting for your review. |
🔔 1st Reminder Hey @TheBlueMatt @jkczyz! This PR has been waiting for your review. |
🔔 5th Reminder Hey @TheBlueMatt @jkczyz! This PR has been waiting for your review. |
🔔 2nd Reminder Hey @TheBlueMatt @jkczyz! This PR has been waiting for your review. |
919b1d8
to
88b2c22
Compare
debug_assert!(self.no_further_updates_allowed()); | ||
debug_assert_ne!(self.funding.funding_txid(), entry.txid); | ||
if let Err(_) = self.promote_funding(entry.txid) { | ||
log_error!(logger, "Missing scope for alternative funding confirmation with txid {}", entry.txid); |
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 would this happen in practice? I assume it's some corner case, but is there any danger in this happening? What would a user do if it happened?
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.
It shouldn't happen at all. It would mean that the scope was somehow removed, and the only way to do that currently is via promote_funding
. The monitor is already not accepting updates so that's good, but it could lead to not being able to claim funds from a closed channel.
Whether it's a splice, or a dual-funded RBF, we need to know which funding transaction out of all of the negotiated ones is currently confirmed in case we need to broadcast the holder commitment.
A `FundingScope` can only be promoted once a `ChannelMonitorUpdateStep::RenegotiatedFundingLocked` is applied, or if the monitor is no longer accepting updates, once the renegotiated funding transaction is no longer under reorg risk. Because of this, our current `FundingScope` may not reflect the latest confirmed state in the chain. Before making a holder commitment broadcast, we must check which `FundingScope` is currently confirmed to ensure that it can propogate throughout the network.
88b2c22
to
89ce01d
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.
LGTM, but should let @TheBlueMatt take a final pass as I'm not intimately familiar with this code.
🔔 3rd Reminder Hey @TheBlueMatt! This PR has been waiting for your review. |
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.
A few assertion nits and one real question that IMO should be addressed, but doesn't have to be in this PR. Gonna land to unblock progress.
A splice's
FundingScope
can only be promoted once aChannelMonitorUpdateStep::RenegotiatedFundingLocked
is applied, or if the monitor is no longer accepting updates, once the splice transaction is no longer under reorg risk. Because of this, our currentFundingScope
may not reflect the latest confirmed state in the chain. Before making a holder commitment broadcast, we must check whichFundingScope
is currently confirmed to ensure that it can propagate throughout the network.