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.

@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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the more important question is whether PendingSplice (or PendingFunding) should be persisted, because currently it isn't.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll persist PendingFunding entirely. Wasn't sure about doing it in this PR or waiting for the additions in #3736.

@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.

@ldk-reviews-bot
Copy link

🔔 2nd 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.

FundedChannel::pending_funding is to be moved to PendingSplice. As such,
it will be persisted with PendingSplice once persistence is added for
the latter.
@jkczyz jkczyz force-pushed the 2025-07-pending-funding branch from d8da168 to 12cc782 Compare July 7, 2025 20:38
@jkczyz
Copy link
Contributor Author

jkczyz commented Jul 7, 2025

Rebased.

Copy link
Contributor

@wpaulino wpaulino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, CI is failing though

@jkczyz jkczyz force-pushed the 2025-07-pending-funding branch 2 times, most recently from 75850ff to db9149c Compare July 8, 2025 17:44
Copy link
Contributor

@wpaulino wpaulino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to squash

@@ -6010,6 +6010,22 @@ where
&[]
}

#[cfg(splicing)]
fn funding_and_pending_funding_iter_mut(&mut self) -> impl Iterator<Item = &mut FundingScope> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

funding_candidates_iter_mut?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It includes the current funding. Without it, we can't chain at the call site without the borrow checker complaining.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, it was a naming suggestion for the method. I think we could consider the current funding to also be a candidate, it's just not "pending".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... by "current" I meant FundedChannel::funding not PendingFunding::funding. The latter is a not yet fully negotiated candidate, while the former is locked. We don't want to consider the latter here.

jkczyz added 4 commits July 8, 2025 12:59
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.
@jkczyz jkczyz force-pushed the 2025-07-pending-funding branch from db9149c to 6dabb81 Compare July 8, 2025 17:59
@jkczyz
Copy link
Contributor Author

jkczyz commented Jul 8, 2025

Squashed. Hopefully CI will be happy.

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.

5 participants