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 38 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 [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 added 27 commits March 4, 2025 22:17
@optout21 optout21 force-pushed the splice-dual-tx2 branch 2 times, most recently from ec051e2 to 81cfce5 Compare March 4, 2025 23:02
@jkczyz jkczyz self-requested a review March 5, 2025 19:13
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