@@ -1417,12 +1417,14 @@ impl<SP: Deref> Channel<SP> where
14171417 if let ChannelPhase::Funded(mut funded_chan) = phase {
14181418 funded_chan.unset_funding_info();
14191419
1420+ let funding = funded_chan.funding;
14201421 let context = funded_chan.context;
14211422 let unfunded_context = UnfundedChannelContext {
14221423 unfunded_channel_age_ticks: 0,
14231424 holder_commitment_point: HolderCommitmentPoint::new(&context.holder_signer, &context.secp_ctx),
14241425 };
14251426 let unfunded_chan = OutboundV1Channel {
1427+ funding,
14261428 context,
14271429 unfunded_context,
14281430 signer_pending_open_channel: false,
@@ -1541,6 +1543,12 @@ impl UnfundedChannelContext {
15411543 }
15421544}
15431545
1546+ /// Information pertaining to an attempt at funding the channel. This is typically constructed
1547+ /// during channel establishment and may be replaced during channel splicing or if the attempted
1548+ /// funding transaction is replaced using tx_init_rbf.
1549+ pub(super) struct FundingScope {
1550+ }
1551+
15441552/// Contains everything about the channel including state, and various flags.
15451553pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
15461554 config: LegacyChannelConfig,
@@ -2185,6 +2193,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
21852193 match self.unfunded_context.holder_commitment_point {
21862194 Some(holder_commitment_point) => {
21872195 let funded_chan = FundedChannel {
2196+ funding: self.funding,
21882197 context: self.context,
21892198 interactive_tx_signing_session: Some(signing_session),
21902199 holder_commitment_point,
@@ -2222,7 +2231,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
22222231 msg_channel_reserve_satoshis: u64,
22232232 msg_push_msat: u64,
22242233 open_channel_fields: msgs::CommonOpenChannelFields,
2225- ) -> Result<ChannelContext<SP>, ChannelError>
2234+ ) -> Result<(FundingScope, ChannelContext<SP>) , ChannelError>
22262235 where
22272236 ES::Target: EntropySource,
22282237 F::Target: FeeEstimator,
@@ -2396,6 +2405,8 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
23962405
23972406 // TODO(dual_funding): Checks for `funding_feerate_sat_per_1000_weight`?
23982407
2408+ let funding = FundingScope {
2409+ };
23992410 let channel_context = ChannelContext {
24002411 user_id,
24012412
@@ -2540,7 +2551,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
25402551 next_funding_txid: None,
25412552 };
25422553
2543- Ok(channel_context)
2554+ Ok((funding, channel_context) )
25442555 }
25452556
25462557 fn new_for_outbound_channel<'a, ES: Deref, F: Deref, L: Deref>(
@@ -2561,7 +2572,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
25612572 holder_signer: <SP::Target as SignerProvider>::EcdsaSigner,
25622573 pubkeys: ChannelPublicKeys,
25632574 _logger: L,
2564- ) -> Result<ChannelContext<SP>, APIError>
2575+ ) -> Result<(FundingScope, ChannelContext<SP>) , APIError>
25652576 where
25662577 ES::Target: EntropySource,
25672578 F::Target: FeeEstimator,
@@ -2627,7 +2638,9 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
26272638
26282639 let temporary_channel_id = temporary_channel_id.unwrap_or_else(|| ChannelId::temporary_from_entropy_source(entropy_source));
26292640
2630- Ok(Self {
2641+ let funding = FundingScope {
2642+ };
2643+ let channel_context = Self {
26312644 user_id,
26322645
26332646 config: LegacyChannelConfig {
@@ -2765,7 +2778,9 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
27652778 local_initiated_shutdown: None,
27662779 is_manual_broadcast: false,
27672780 next_funding_txid: None,
2768- })
2781+ };
2782+
2783+ Ok((funding, channel_context))
27692784 }
27702785
27712786 pub(crate) fn get_value_to_self_msat(&self) -> u64 {self.value_to_self_msat}
@@ -4534,6 +4549,7 @@ pub(super) struct DualFundingChannelContext {
45344549// Holder designates channel data owned for the benefit of the user client.
45354550// Counterparty designates channel data owned by the another channel participant entity.
45364551pub(super) struct FundedChannel<SP: Deref> where SP::Target: SignerProvider {
4552+ pub funding: FundingScope,
45374553 pub context: ChannelContext<SP>,
45384554 pub interactive_tx_signing_session: Option<InteractiveTxSigningSession>,
45394555 holder_commitment_point: HolderCommitmentPoint,
@@ -8550,6 +8566,7 @@ impl<SP: Deref> FundedChannel<SP> where
85508566
85518567/// A not-yet-funded outbound (from holder) channel using V1 channel establishment.
85528568pub(super) struct OutboundV1Channel<SP: Deref> where SP::Target: SignerProvider {
8569+ pub funding: FundingScope,
85538570 pub context: ChannelContext<SP>,
85548571 pub unfunded_context: UnfundedChannelContext,
85558572 /// We tried to send an `open_channel` message but our commitment point wasn't ready.
@@ -8581,7 +8598,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
85818598 let holder_signer = signer_provider.derive_channel_signer(channel_value_satoshis, channel_keys_id);
85828599 let pubkeys = holder_signer.pubkeys().clone();
85838600
8584- let context = ChannelContext::new_for_outbound_channel(
8601+ let (funding, context) = ChannelContext::new_for_outbound_channel(
85858602 fee_estimator,
85868603 entropy_source,
85878604 signer_provider,
@@ -8607,7 +8624,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
86078624
86088625 // We initialize `signer_pending_open_channel` to false, and leave setting the flag
86098626 // for when we try to generate the open_channel message.
8610- let chan = Self { context, unfunded_context, signer_pending_open_channel: false };
8627+ let chan = Self { funding, context, unfunded_context, signer_pending_open_channel: false };
86118628 Ok(chan)
86128629 }
86138630
@@ -8807,6 +8824,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
88078824 log_info!(logger, "Received funding_signed from peer for channel {}", &self.context.channel_id());
88088825
88098826 let mut channel = FundedChannel {
8827+ funding: self.funding,
88108828 context: self.context,
88118829 interactive_tx_signing_session: None,
88128830 holder_commitment_point,
@@ -8847,6 +8865,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
88478865
88488866/// A not-yet-funded inbound (from counterparty) channel using V1 channel establishment.
88498867pub(super) struct InboundV1Channel<SP: Deref> where SP::Target: SignerProvider {
8868+ pub funding: FundingScope,
88508869 pub context: ChannelContext<SP>,
88518870 pub unfunded_context: UnfundedChannelContext,
88528871 pub signer_pending_accept_channel: bool,
@@ -8915,7 +8934,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
89158934 htlc_basepoint: HtlcBasepoint::from(msg.common_fields.htlc_basepoint)
89168935 };
89178936
8918- let context = ChannelContext::new_for_inbound_channel(
8937+ let (funding, context) = ChannelContext::new_for_inbound_channel(
89198938 fee_estimator,
89208939 entropy_source,
89218940 signer_provider,
@@ -8939,7 +8958,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
89398958 unfunded_channel_age_ticks: 0,
89408959 holder_commitment_point: HolderCommitmentPoint::new(&context.holder_signer, &context.secp_ctx),
89418960 };
8942- let chan = Self { context, unfunded_context, signer_pending_accept_channel: false };
8961+ let chan = Self { funding, context, unfunded_context, signer_pending_accept_channel: false };
89438962 Ok(chan)
89448963 }
89458964
@@ -9072,6 +9091,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
90729091 // Promote the channel to a full-fledged one now that we have updated the state and have a
90739092 // `ChannelMonitor`.
90749093 let mut channel = FundedChannel {
9094+ funding: self.funding,
90759095 context: self.context,
90769096 interactive_tx_signing_session: None,
90779097 holder_commitment_point,
@@ -9105,6 +9125,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
91059125
91069126// A not-yet-funded channel using V2 channel establishment.
91079127pub(super) struct PendingV2Channel<SP: Deref> where SP::Target: SignerProvider {
9128+ pub funding: FundingScope,
91089129 pub context: ChannelContext<SP>,
91099130 pub unfunded_context: UnfundedChannelContext,
91109131 pub dual_funding_context: DualFundingChannelContext,
@@ -9141,7 +9162,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
91419162 "Provided current chain height of {} doesn't make sense for a height-based timelock for the funding transaction",
91429163 current_chain_height) })?;
91439164
9144- let context = ChannelContext::new_for_outbound_channel(
9165+ let (funding, context) = ChannelContext::new_for_outbound_channel(
91459166 fee_estimator,
91469167 entropy_source,
91479168 signer_provider,
@@ -9165,6 +9186,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
91659186 holder_commitment_point: HolderCommitmentPoint::new(&context.holder_signer, &context.secp_ctx),
91669187 };
91679188 let chan = Self {
9189+ funding,
91689190 context,
91699191 unfunded_context,
91709192 dual_funding_context: DualFundingChannelContext {
@@ -9291,7 +9313,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
92919313 htlc_basepoint: HtlcBasepoint(msg.common_fields.htlc_basepoint)
92929314 };
92939315
9294- let mut context = ChannelContext::new_for_inbound_channel(
9316+ let (funding, mut context) = ChannelContext::new_for_inbound_channel(
92959317 fee_estimator,
92969318 entropy_source,
92979319 signer_provider,
@@ -9347,6 +9369,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
93479369 holder_commitment_point: HolderCommitmentPoint::new(&context.holder_signer, &context.secp_ctx),
93489370 };
93499371 Ok(Self {
9372+ funding,
93509373 context,
93519374 dual_funding_context,
93529375 interactive_tx_constructor,
@@ -10320,6 +10343,8 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
1032010343 };
1032110344
1032210345 Ok(FundedChannel {
10346+ funding: FundingScope {
10347+ },
1032310348 context: ChannelContext {
1032410349 user_id,
1032510350
0 commit comments