Skip to content

Dual funding extension: begin_interactive_funding_tx_construction - #3443

Merged
wpaulino merged 2 commits into
lightningdevkit:mainfrom
optout21:splicing-dual-reqs2
Apr 2, 2025
Merged

Dual funding extension: begin_interactive_funding_tx_construction#3443
wpaulino merged 2 commits into
lightningdevkit:mainfrom
optout21:splicing-dual-reqs2

Conversation

@optout21

@optout21optout21 commented Dec 5, 2024

Copy link
Copy Markdown
Contributor

Add these two methods to the current dual funding implementation:
begin_interactive_funding_tx_construction()
calculate_change_output_value()

These changes are in the pipeline for dual funding implementation, and needed for dual funding negotiation during splicing, in #3444 . This PR doesn't contain the splicing-specific bits.

Additionally, as a result of a review finding:

  • From the OutputOwned enum, we have removed the SharedControlFullyOwned option, as Shared can covers it as well. It can cover any balance spit combination, including the case when the full amount is at one counterparty.

@dunxen

Copy link
Copy Markdown
Contributor

Makes sense to get this this in so it can unblock you as #2302 will still take time. Is this much different from what is in #2302/any of the splicing PRs?

@jkczyz
jkczyz self-requested a review December 5, 2024 15:22
@optout21

optout21 commented Dec 5, 2024

Copy link
Copy Markdown
ContributorAuthor

TODO: I need to run a comparison against current version of dual funding WIP

@optout21
optout21force-pushed the splicing-dual-reqs2 branch 2 times, most recently from 4f7e41b to 0448cf9CompareDecember 6, 2024 15:20
@optout21

Copy link
Copy Markdown
ContributorAuthor

Did the following:

  • break up maybe_add_funding_change_output() into two: one part for determining if a change needs to be added, and the other to actually add it
  • moved need_to_add_funding_change_output() into interactivetxs.rs
  • added unit tests for need_to_add_funding_change_output()

@optout21optout21 changed the title [Draft] Dual funding extension needed for Splicing, begin_interactive_funding_tx_constructionDual funding extension needed for Splicing, begin_interactive_funding_tx_constructionDec 6, 2024
@optout21
optout21 marked this pull request as ready for review December 6, 2024 15:23
@optout21optout21 changed the title Dual funding extension needed for Splicing, begin_interactive_funding_tx_constructionDual funding extension needed also for splicing: begin_interactive_funding_tx_constructionDec 6, 2024
Comment threadlightning/src/ln/interactivetxs.rs Outdated
Comment threadlightning/src/ln/interactivetxs.rs Outdated
Comment threadlightning/src/ln/interactivetxs.rs Outdated
Comment threadlightning/src/ln/interactivetxs.rs
@optout21
optout21 requested a review from dunxenDecember 6, 2024 16:39
Comment threadlightning/src/ln/channel.rs Outdated
@optout21
optout21 requested a review from dunxenDecember 9, 2024 07:22

@jkczyzjkczyz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you update the commit message with the rationale for the change? (i.e., specifically how it will be used in splicing)

Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
@optout21

Copy link
Copy Markdown
ContributorAuthor

Review comments addressed, all resolved from my side (left a few open for visibility)

@codecov

codecovBot commented Dec 11, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 58.33333% with 105 lines in your changes missing coverage. Please review.

Project coverage is 90.43%. Comparing base (830ffa0) to head (f1a8602).
Report is 39 commits behind head on main.

Files with missing linesPatch %Lines
lightning/src/ln/channel.rs11.49%77 Missing ⚠️
lightning/src/ln/interactivetxs.rs83.03%28 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #3443 +/- ##
==========================================
+ Coverage 89.26% 90.43% +1.16% 
==========================================
Files 155 155 Lines 119968 130672 +10704 Branches 119968 130672 +10704 ==========================================
+ Hits 107092 118174 +11082 + Misses 10265 9924 -341 + Partials 2611 2574 -37 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@optout21

Copy link
Copy Markdown
ContributorAuthor

Rebased.

@optout21
optout21force-pushed the splicing-dual-reqs2 branch 2 times, most recently from d40e961 to 07c805cCompareMarch 20, 2025 08:09
Comment threadlightning/src/ln/interactivetxs.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
@optout21

Copy link
Copy Markdown
ContributorAuthor

Picked up this again, review comments addressed.

@optout21
optout21 requested a review from jkczyzMarch 24, 2025 11:37
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/interactivetxs.rs Outdated
Comment threadlightning/src/ln/interactivetxs.rs Outdated
@optout21
optout21 requested a review from jkczyzMarch 24, 2025 17:01
Comment threadlightning/src/ln/channel.rs
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/interactivetxs.rs
Comment threadlightning/src/ln/interactivetxs.rs Outdated
Comment threadlightning/src/ln/channel.rs
Comment threadlightning/src/ln/channel.rs
Comment threadlightning/src/ln/interactivetxs.rs Outdated
@optout21
optout21 marked this pull request as draft March 25, 2025 15:34
@optout21optout21 changed the title Dual funding extension, needed also for splicing: begin_interactive_funding_tx_constructionDual funding extension: begin_interactive_funding_tx_constructionMar 26, 2025
@optout21

Copy link
Copy Markdown
ContributorAuthor

Changes in reaction to comments, most notably:

  • splicing consideration dropped, so splicing specific concerns (e.g. filling shared_input_txid, correct balances) can be postponed
  • prev tx check is inlined, not a separate method
  • error handling simplified (no parameters, less new error values)

@optout21
optout21 marked this pull request as ready for review March 26, 2025 11:30
@optout21
optout21 requested a review from wpaulinoMarch 26, 2025 11:30
@optout21
optout21force-pushed the splicing-dual-reqs2 branch from 981086f to 9328962CompareMarch 26, 2025 11:32

@jkczyzjkczyz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment threadlightning/src/ln/interactivetxs.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/interactivetxs.rs Outdated
Comment threadlightning/src/ln/interactivetxs.rs Outdated
@optout21
optout21 marked this pull request as draft March 27, 2025 05:14
@optout21
optout21 marked this pull request as ready for review March 27, 2025 05:21
@optout21
optout21 requested a review from jkczyzMarch 27, 2025 05:21

@jkczyzjkczyz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm good with this now. Should squash into three commits, IMO.

  • main change
  • removal of SharedControlFullyOwned
  • bug fix

Comment threadlightning/src/ln/interactivetxs.rs
@optout21

optout21 commented Mar 27, 2025

Copy link
Copy Markdown
ContributorAuthor

Squashed. Kept the SharedControlFullyOwned removal in a separate commit (the proposed 3rd commit is closely related to it, not separate).

jkczyz
jkczyz previously approved these changes Mar 31, 2025
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs
Comment threadlightning/src/ln/interactivetxs.rs Outdated
Comment threadlightning/src/ln/interactivetxs.rs
Comment threadlightning/src/ln/channel.rs
@wpaulino

Copy link
Copy Markdown
Contributor

LGTM after squash

@optout21

Copy link
Copy Markdown
ContributorAuthor

LGTM after squash

Squashed (fix commit into the first one, kept 2nd separate)

jkczyz
jkczyz previously approved these changes Apr 2, 2025
Comment threadlightning/src/ln/interactivetxs.rs Outdated
This method is needed by both V2 channel open and splicing.
Auxiliary changes:
- New method `calculate_change_output_value()` for determining if
a change output is needed, and with what value.
- In `interactivetxs.rs` adjust the visibility of
`SharedOwnedOutput` and `OutputOwned` structs (were not used before).
- In `DualFundingChannelContext` add a new field for the counterparty
contribution, `their_funding_satoshis`.
The Shared option can cover it as well.
@optout21

Copy link
Copy Markdown
ContributorAuthor

'Conversation 155' -- thanks for the patience, @jkczyz & @wpaulino !

image

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Splicingweekly goalSomeone wants to land this this week

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@optout21@dunxen@jkczyz@wpaulino