Skip to content

Dual funding extension: begin_interactive_funding_tx_construction#3443

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

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

Conversation

@optout21
Copy link
Contributor

@optout21 optout21 commented Dec 5, 2024

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
Contributor

dunxen commented Dec 5, 2024

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
Copy link
Contributor Author

optout21 commented Dec 5, 2024

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

@optout21 optout21 force-pushed the splicing-dual-reqs2 branch 2 times, most recently from 4f7e41b to 0448cf9 Compare December 6, 2024 15:20
@optout21
Copy link
Contributor Author

optout21 commented Dec 6, 2024

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()

@optout21 optout21 changed the title [Draft] Dual funding extension needed for Splicing, begin_interactive_funding_tx_construction Dual funding extension needed for Splicing, begin_interactive_funding_tx_construction Dec 6, 2024
@optout21 optout21 marked this pull request as ready for review December 6, 2024 15:23
@optout21 optout21 changed the title Dual funding extension needed for Splicing, begin_interactive_funding_tx_construction Dual funding extension needed also for splicing: begin_interactive_funding_tx_construction Dec 6, 2024
@optout21 optout21 force-pushed the splicing-dual-reqs2 branch from 0448cf9 to 0e47819 Compare December 6, 2024 15:43
@optout21 optout21 requested a review from dunxen December 6, 2024 16:39
@optout21 optout21 force-pushed the splicing-dual-reqs2 branch from 48e0518 to 9e44d2b Compare December 6, 2024 16:41
@optout21 optout21 force-pushed the splicing-dual-reqs2 branch from 9e44d2b to b7e7a34 Compare December 9, 2024 07:20
@optout21 optout21 requested a review from dunxen December 9, 2024 07:22
Copy link
Contributor

@jkczyz jkczyz left a comment

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)

@optout21 optout21 force-pushed the splicing-dual-reqs2 branch from 70fde13 to b1ae668 Compare December 11, 2024 16:49
@optout21
Copy link
Contributor Author

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

@optout21 optout21 force-pushed the splicing-dual-reqs2 branch from b1ae668 to 86f9680 Compare December 11, 2024 16:56
@optout21 optout21 requested a review from jkczyz December 11, 2024 16:57
@optout21 optout21 force-pushed the splicing-dual-reqs2 branch from 86f9680 to a379f1d Compare December 11, 2024 19:37
@codecov
Copy link

codecov bot commented Dec 11, 2024

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 lines Patch % Lines
lightning/src/ln/channel.rs 11.49% 77 Missing ⚠️
lightning/src/ln/interactivetxs.rs 83.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 optout21 force-pushed the splicing-dual-reqs2 branch from a379f1d to 9256a47 Compare December 14, 2024 12:40
@optout21 optout21 force-pushed the splicing-dual-reqs2 branch from 9256a47 to 5194458 Compare January 6, 2025 09:57
@optout21
Copy link
Contributor Author

optout21 commented Jan 6, 2025

Rebased.

@optout21 optout21 force-pushed the splicing-dual-reqs2 branch 2 times, most recently from d40e961 to 07c805c Compare March 20, 2025 08:09
@optout21
Copy link
Contributor Author

Picked up this again, review comments addressed.

@optout21 optout21 requested a review from jkczyz March 24, 2025 11:37
@optout21 optout21 requested a review from jkczyz March 24, 2025 17:01
@optout21 optout21 marked this pull request as draft March 25, 2025 15:34
@optout21 optout21 changed the title Dual funding extension, needed also for splicing: begin_interactive_funding_tx_construction Dual funding extension: begin_interactive_funding_tx_construction Mar 26, 2025
@optout21
Copy link
Contributor Author

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 wpaulino March 26, 2025 11:30
@optout21 optout21 force-pushed the splicing-dual-reqs2 branch from 981086f to 9328962 Compare March 26, 2025 11:32
Copy link
Contributor

@jkczyz jkczyz left a comment

Choose a reason for hiding this comment

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

@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 jkczyz March 27, 2025 05:21
Copy link
Contributor

@jkczyz jkczyz left a comment

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

@optout21
Copy link
Contributor Author

optout21 commented Mar 27, 2025

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
@wpaulino
Copy link
Contributor

wpaulino commented Apr 1, 2025

LGTM after squash

@optout21
Copy link
Contributor Author

optout21 commented Apr 2, 2025

LGTM after squash

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

jkczyz
jkczyz previously approved these changes Apr 2, 2025
optout21 added 2 commits April 2, 2025 17:46
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
Contributor Author

optout21 commented Apr 4, 2025

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

image

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

Labels

Splicing weekly goal Someone wants to land this this week

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants