-
Notifications
You must be signed in to change notification settings - Fork 415
Refactor PendingSplice
#3911
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?
Refactor PendingSplice
#3911
Conversation
FundedChannel::pending_funding is to be moved to PendingSplice. As such, it will be persisted with PendingSplice once persistence is added for the latter.
FundedChannel::pending_funding and FundedChannel::pending_splice were developed independently, but the former will only contain values when the latter is set.
An upcoming commit will rename PendingSplice to PendingFunding. Thus, rename the similarly named field to something more meaningful. It includes FundingScopes that have been negotiated but have not reached enough confirmations by both parties to have exchanged splice_locked.
While PendingSplice is only used for splicing a FundedChannel, it will be useful when supporting RBF for V2 channel establishment.
Now that PendingFunding directly contains the negotiated candidates, some unnecessary checks can be removed.
👋 Thanks for assigning @wpaulino as a reviewer! |
@@ -12616,7 +12616,6 @@ where | |||
(49, self.context.local_initiated_shutdown, option), // Added in 0.0.122 | |||
(51, is_manual_broadcast, option), // Added in 0.0.124 | |||
(53, funding_tx_broadcast_safe_event_emitted, option), // Added in 0.0.124 | |||
(54, self.pending_funding, optional_vec), // Added in 0.2 |
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 still have the opportunity to reuse 54 for negotiated_candidates
when we persist that, right?
lightning/src/ln/channel.rs
Outdated
) -> Option<msgs::SpliceLocked> | ||
where | ||
SP::Target: SignerProvider, | ||
{ | ||
debug_assert!(confirmed_funding_index < self.pending_funding.len()); | ||
|
||
let funding = self.pending_funding.get(confirmed_funding_index).unwrap(); |
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.
nit: If we're going to unwrap, why not just let funding = &self.pending_funding[confirmed_funding_index];
?
I guess the explicit unwrap is informative on the other hand.
🔔 1st Reminder Hey @wpaulino! This PR has been waiting for your review. |
FundedChannel::pending_funding
andFundedChannel::pending_splice
were developed independently, but the former will only contain values when the latter is set. This PR moves the former intoPendingSplice
and renames it tonegotiated_candidates
. It also removes unnecessary checks forFundedChannel::pending_splice
and renamesPendingSplice
toPendingFunding
. This allows for usingPendingFunding
for V2 channel establishment in order to support RBF.