-
Notifications
You must be signed in to change notification settings - Fork 410
Introduce RenegotiatedFunding monitor update variant #3822
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?
Introduce RenegotiatedFunding monitor update variant #3822
Conversation
We shouldn't track our `HTLCSource`s within our `HolderCommitmentTransaction`s duplicatively for each `FundingScope`. With splicing, we may have alternative holder commitment transactions, but they must all have the same set of non-dust and dust HTLCs as the pre-spliced commitment transaction. Different sets of HTLCs are only possible with a change to the dust limit on commitment transactions, which the splicing protocol does not currently support. This commit moves the `nondust_htlc_sources` and `dust_htlcs` fields out from each `FundingScope` into the `ChannelMonitor`, such that they can be reused for each `FundingScope`. This remains as a backwards compatible change, the underlying stored data is not changed, but where it lives in memory is.
This is a new `ChannelMonitorUpdateStep` variant intended to be used whenever a new funding transaction for the channel has been negotiated via the `InteractiveTxConstructor`. This commit primarily focuses on its use for splices, but future work will expand where needed to support RBFs (both for the initial dual funding transaction, and splice transactions). To draw a parallel to channel open, we generally want to have the commitment transactions negotiated for the funding transaction and committed to the respective `ChannelMonitor` before attempting to sign the funding transaction itself. This monitor update fulfills this need for a newly negotiated splice; it includes both the new holder and counterparty commitment transactions, and the new set of applicable `ChannelTransactionParameters`. Once the monitor update has been applied to the monitor and persisted, we allow the release of our `tx_signatures` for the splice transaction to wait for its confirmation.
👋 Thanks for assigning @jkczyz as a reviewer! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3822 +/- ##
==========================================
- Coverage 89.75% 89.67% -0.08%
==========================================
Files 159 160 +1
Lines 128906 129281 +375
Branches 128906 129281 +375
==========================================
+ Hits 115697 115932 +235
- Misses 10512 10639 +127
- Partials 2697 2710 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
} | ||
|
||
fn funding_txid(&self) -> Txid { | ||
self.channel_parameters.funding_outpoint.as_ref().unwrap().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.
Should we use expect
here, too?
if msg.batch.is_some() { | ||
return Err(ChannelError::close("Peer sent splice initial commitment_signed with a batch".to_owned())); | ||
} |
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.
May as well drop this given #3793.
.map(|session| session.has_received_commitment_signed()) | ||
.unwrap_or(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.
Could you help me understand the difference between the case where session.has_received_commitment_signed()
is false and where we don't have an interactive_tx_signing_session
?
let tx_signatures = self.interactive_tx_signing_session.as_mut() | ||
.and_then(|session| session.received_commitment_signed()); |
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 we not have an interactive_tx_signing_session
here?
👋 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. |
This is a new
ChannelMonitorUpdateStep
variant intended to be used whenever a new funding transaction for the channel has been negotiated via theInteractiveTxConstructor
. This commit primarily focuses on its use for splices, but future work will expand where needed to support RBFs (both for the initial dual funding transaction, and splice transactions).To draw a parallel to channel open, we generally want to have the commitment transactions negotiated for the funding transaction and committed to the respective
ChannelMonitor
before attempting to sign the funding transaction itself. This monitor update fulfills this need for a newly negotiated splice; it includes both the new holder and counterparty commitment transactions, and the new set of applicableChannelTransactionParameters
. Once the monitor update has been applied to the monitor and persisted, we allow the release of ourtx_signatures
for the splice transaction to wait for its confirmation.Note: This currently doesn't build without some of the work done in #3736.
Depends on #3774.