Skip to content

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jkczyz
Copy link
Contributor

@jkczyz jkczyz commented Jul 3, 2025

FundedChannel::pending_funding and FundedChannel::pending_splice were developed independently, but the former will only contain values when the latter is set. This PR moves the former into PendingSplice and renames it to negotiated_candidates. It also removes unnecessary checks for FundedChannel::pending_splice and renames PendingSplice to PendingFunding. This allows for using PendingFunding for V2 channel establishment in order to support RBF.

jkczyz added 5 commits July 2, 2025 15:30
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.
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Jul 3, 2025

👋 Thanks for assigning @wpaulino as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@jkczyz jkczyz self-assigned this Jul 3, 2025
@jkczyz jkczyz requested a review from wpaulino July 3, 2025 16:05
@jkczyz jkczyz moved this to Goal: Merge in Weekly Goals Jul 3, 2025
@@ -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
Copy link
Contributor

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?

) -> 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();
Copy link
Contributor

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.

@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @wpaulino! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Goal: Merge
Development

Successfully merging this pull request may close these issues.

3 participants