Skip to content
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

[Early Draft][Splicing] Interactive tx negotiation, with a single ChannelContext. #3630

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

optout21
Copy link
Contributor

@optout21 optout21 commented Feb 28, 2025

@optout21
Copy link
Contributor Author

optout21 commented Feb 28, 2025

Status: it is mostly implemented, in a rough form, but it's not fully functional, due to some fields needing to be moved to FundingScope.

	/// Fields from FundedChannel
	pub pre_funding: FundingScope,
	pub context: ChannelContext<SP>,
	pre_holder_commitment_point: HolderCommitmentPoint,
	pending_splice_pre: PendingSplicePre,
	pending_splice_post: PendingSplicePost,

	// Fields from PendingV2Channel follow, except ChannelContext, which is reused from above
	pub post_funding: FundingScope,
	pub unfunded_context: UnfundedChannelContext,
	/// Used when negotiating the splice transaction
	pub dual_funding_context: DualFundingChannelContext,
	/// The current interactive transaction construction session under negotiation.
	pub interactive_tx_constructor: Option<InteractiveTxConstructor>,
  • Avoid duplications 1. Since channel fields are duplicated, some of its methods need to be duplicated as well. First trick to reduce is to include the full FundedChannel (instead of its fields):
	pub pre_funded: FundedChannel<SP>,

	// Fields from PendingV2Channel follow, except ChannelContext, which is reused from above
	pub post_funding: FundingScope,
	pub unfunded_context: UnfundedChannelContext,
	/// Used when negotiating the splice transaction
	pub dual_funding_context: DualFundingChannelContext,
	/// The current interactive transaction construction session under negotiation.
	pub interactive_tx_constructor: Option<InteractiveTxConstructor>,
  • Avoid duplications 2. Method duplications can be avoided by making FundedChannel and PendingV2Channel traits, with some common implementations (accessing fields through accessiors), and making FundedChannel, PendingV2Channel, and SplicingChannel implementing relevant accessors. This is not yet done.

  • Functional issue, failure during commitment exchange.
    The process fails somewhere around commitment exchange, with a force close. The reason is that some fields which were duplicated and changed in [Early Draft][Splicing] Partial, perform interactive transaction negotiation for new funding #3444, are not duplicated currently.

These fields can be seen in new_for_splice() and new_spliced(). They are:

  • funding_tx_confirmed_in
  • funding_tx_confirmation_height
  • channel_transaction_parameters.funding_outpoint
  • channel_state
  • next_funding_txid
  • latest_monitor_update_id
  • channel_pending_event_emitted
  • channel_ready_event_emitted
  • blocked_monitor_updates

Note that some of the most important fields have been already moved to FundingScope:

@optout21 optout21 marked this pull request as draft February 28, 2025 13:46
@optout21 optout21 force-pushed the splice-dual-tx2 branch 3 times, most recently from 81cfce5 to 7dba1df Compare March 4, 2025 23:34
@jkczyz jkczyz self-requested a review March 5, 2025 19:13
Copy link

codecov bot commented Mar 10, 2025

Codecov Report

Attention: Patch coverage is 53.79538% with 140 lines in your changes missing coverage. Please review.

Project coverage is 89.14%. Comparing base (4c43a5b) to head (1994c40).

Files with missing lines Patch % Lines
lightning/src/ln/channel.rs 25.26% 138 Missing and 1 partial ⚠️
lightning/src/ln/functional_test_utils.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3630      +/-   ##
==========================================
- Coverage   89.24%   89.14%   -0.10%     
==========================================
  Files         155      155              
  Lines      119280   119542     +262     
  Branches   119280   119542     +262     
==========================================
+ Hits       106446   106569     +123     
- Misses      10240    10373     +133     
- Partials     2594     2600       +6     

☔ 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
Contributor Author

optout21 commented Mar 10, 2025

Completed, transaction negotiation is going through for the splicing transaction (@jkczyz).
Commitment exchange is not done (the test stops before that), but in fact #3444 also did not have that part (I'm not sure why).
Also rebased with current master, incl. #3407; number of commits reduced (from 38 to 14).

@optout21 optout21 force-pushed the splice-dual-tx2 branch 2 times, most recently from 049d853 to 1c3b4da Compare March 19, 2025 23:10
@optout21
Copy link
Contributor Author

Progress: Extended implementation to handle last tx_complete, create signature on shared input, and emit FundingTransactionReadyForSigning event.

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

Successfully merging this pull request may close these issues.

1 participant