@@ -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,
@@ -2198,6 +2206,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
21982206 match self.unfunded_context.holder_commitment_point {
21992207 Some(holder_commitment_point) => {
22002208 let funded_chan = FundedChannel {
2209+ funding: self.funding,
22012210 context: self.context,
22022211 interactive_tx_signing_session: Some(signing_session),
22032212 holder_commitment_point,
@@ -2235,7 +2244,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
22352244 msg_channel_reserve_satoshis: u64,
22362245 msg_push_msat: u64,
22372246 open_channel_fields: msgs::CommonOpenChannelFields,
2238- ) -> Result<ChannelContext<SP>, ChannelError>
2247+ ) -> Result<(FundingScope, ChannelContext<SP>) , ChannelError>
22392248 where
22402249 ES::Target: EntropySource,
22412250 F::Target: FeeEstimator,
@@ -2409,6 +2418,8 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
24092418
24102419 // TODO(dual_funding): Checks for `funding_feerate_sat_per_1000_weight`?
24112420
2421+ let funding = FundingScope {
2422+ };
24122423 let channel_context = ChannelContext {
24132424 user_id,
24142425
@@ -2553,7 +2564,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
25532564 next_funding_txid: None,
25542565 };
25552566
2556- Ok(channel_context)
2567+ Ok((funding, channel_context) )
25572568 }
25582569
25592570 fn new_for_outbound_channel<'a, ES: Deref, F: Deref, L: Deref>(
@@ -2574,7 +2585,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
25742585 holder_signer: <SP::Target as SignerProvider>::EcdsaSigner,
25752586 pubkeys: ChannelPublicKeys,
25762587 _logger: L,
2577- ) -> Result<ChannelContext<SP>, APIError>
2588+ ) -> Result<(FundingScope, ChannelContext<SP>) , APIError>
25782589 where
25792590 ES::Target: EntropySource,
25802591 F::Target: FeeEstimator,
@@ -2640,7 +2651,9 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
26402651
26412652 let temporary_channel_id = temporary_channel_id.unwrap_or_else(|| ChannelId::temporary_from_entropy_source(entropy_source));
26422653
2643- Ok(Self {
2654+ let funding = FundingScope {
2655+ };
2656+ let channel_context = Self {
26442657 user_id,
26452658
26462659 config: LegacyChannelConfig {
@@ -2778,7 +2791,9 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
27782791 local_initiated_shutdown: None,
27792792 is_manual_broadcast: false,
27802793 next_funding_txid: None,
2781- })
2794+ };
2795+
2796+ Ok((funding, channel_context))
27822797 }
27832798
27842799 // CHANGES
@@ -4556,6 +4571,7 @@ pub(super) struct DualFundingChannelContext {
45564571// Holder designates channel data owned for the benefit of the user client.
45574572// Counterparty designates channel data owned by the another channel participant entity.
45584573pub(super) struct FundedChannel<SP: Deref> where SP::Target: SignerProvider {
4574+ pub funding: FundingScope,
45594575 pub context: ChannelContext<SP>,
45604576 pub interactive_tx_signing_session: Option<InteractiveTxSigningSession>,
45614577 holder_commitment_point: HolderCommitmentPoint,
@@ -8572,6 +8588,7 @@ impl<SP: Deref> FundedChannel<SP> where
85728588
85738589/// A not-yet-funded outbound (from holder) channel using V1 channel establishment.
85748590pub(super) struct OutboundV1Channel<SP: Deref> where SP::Target: SignerProvider {
8591+ pub funding: FundingScope,
85758592 pub context: ChannelContext<SP>,
85768593 pub unfunded_context: UnfundedChannelContext,
85778594 /// We tried to send an `open_channel` message but our commitment point wasn't ready.
@@ -8603,7 +8620,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
86038620 let holder_signer = signer_provider.derive_channel_signer(channel_value_satoshis, channel_keys_id);
86048621 let pubkeys = holder_signer.pubkeys().clone();
86058622
8606- let context = ChannelContext::new_for_outbound_channel(
8623+ let (funding, context) = ChannelContext::new_for_outbound_channel(
86078624 fee_estimator,
86088625 entropy_source,
86098626 signer_provider,
@@ -8629,7 +8646,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
86298646
86308647 // We initialize `signer_pending_open_channel` to false, and leave setting the flag
86318648 // for when we try to generate the open_channel message.
8632- let chan = Self { context, unfunded_context, signer_pending_open_channel: false };
8649+ let chan = Self { funding, context, unfunded_context, signer_pending_open_channel: false };
86338650 Ok(chan)
86348651 }
86358652
@@ -8829,6 +8846,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
88298846 log_info!(logger, "Received funding_signed from peer for channel {}", &self.context.channel_id());
88308847
88318848 let mut channel = FundedChannel {
8849+ funding: self.funding,
88328850 context: self.context,
88338851 interactive_tx_signing_session: None,
88348852 holder_commitment_point,
@@ -8869,6 +8887,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
88698887
88708888/// A not-yet-funded inbound (from counterparty) channel using V1 channel establishment.
88718889pub(super) struct InboundV1Channel<SP: Deref> where SP::Target: SignerProvider {
8890+ pub funding: FundingScope,
88728891 pub context: ChannelContext<SP>,
88738892 pub unfunded_context: UnfundedChannelContext,
88748893 pub signer_pending_accept_channel: bool,
@@ -8937,7 +8956,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
89378956 htlc_basepoint: HtlcBasepoint::from(msg.common_fields.htlc_basepoint)
89388957 };
89398958
8940- let context = ChannelContext::new_for_inbound_channel(
8959+ let (funding, context) = ChannelContext::new_for_inbound_channel(
89418960 fee_estimator,
89428961 entropy_source,
89438962 signer_provider,
@@ -8961,7 +8980,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
89618980 unfunded_channel_age_ticks: 0,
89628981 holder_commitment_point: HolderCommitmentPoint::new(&context.holder_signer, &context.secp_ctx),
89638982 };
8964- let chan = Self { context, unfunded_context, signer_pending_accept_channel: false };
8983+ let chan = Self { funding, context, unfunded_context, signer_pending_accept_channel: false };
89658984 Ok(chan)
89668985 }
89678986
@@ -9094,6 +9113,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
90949113 // Promote the channel to a full-fledged one now that we have updated the state and have a
90959114 // `ChannelMonitor`.
90969115 let mut channel = FundedChannel {
9116+ funding: self.funding,
90979117 context: self.context,
90989118 interactive_tx_signing_session: None,
90999119 holder_commitment_point,
@@ -9127,6 +9147,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
91279147
91289148// A not-yet-funded channel using V2 channel establishment.
91299149pub(super) struct PendingV2Channel<SP: Deref> where SP::Target: SignerProvider {
9150+ pub funding: FundingScope,
91309151 pub context: ChannelContext<SP>,
91319152 pub unfunded_context: UnfundedChannelContext,
91329153 pub dual_funding_context: DualFundingChannelContext,
@@ -9163,7 +9184,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
91639184 "Provided current chain height of {} doesn't make sense for a height-based timelock for the funding transaction",
91649185 current_chain_height) })?;
91659186
9166- let context = ChannelContext::new_for_outbound_channel(
9187+ let (funding, context) = ChannelContext::new_for_outbound_channel(
91679188 fee_estimator,
91689189 entropy_source,
91699190 signer_provider,
@@ -9187,6 +9208,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
91879208 holder_commitment_point: HolderCommitmentPoint::new(&context.holder_signer, &context.secp_ctx),
91889209 };
91899210 let chan = Self {
9211+ funding,
91909212 context,
91919213 unfunded_context,
91929214 dual_funding_context: DualFundingChannelContext {
@@ -9313,7 +9335,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
93139335 htlc_basepoint: HtlcBasepoint(msg.common_fields.htlc_basepoint)
93149336 };
93159337
9316- let mut context = ChannelContext::new_for_inbound_channel(
9338+ let (funding, mut context) = ChannelContext::new_for_inbound_channel(
93179339 fee_estimator,
93189340 entropy_source,
93199341 signer_provider,
@@ -9369,6 +9391,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
93699391 holder_commitment_point: HolderCommitmentPoint::new(&context.holder_signer, &context.secp_ctx),
93709392 };
93719393 Ok(Self {
9394+ funding,
93729395 context,
93739396 dual_funding_context,
93749397 interactive_tx_constructor,
@@ -10342,6 +10365,8 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
1034210365 };
1034310366
1034410367 Ok(FundedChannel {
10368+ funding: FundingScope {
10369+ },
1034510370 context: ChannelContext {
1034610371 user_id,
1034710372
0 commit comments