@@ -1417,12 +1417,14 @@ impl<SP: Deref> Channel<SP> where
1417
1417
if let ChannelPhase::Funded(mut funded_chan) = phase {
1418
1418
funded_chan.unset_funding_info();
1419
1419
1420
+ let funding = funded_chan.funding;
1420
1421
let context = funded_chan.context;
1421
1422
let unfunded_context = UnfundedChannelContext {
1422
1423
unfunded_channel_age_ticks: 0,
1423
1424
holder_commitment_point: HolderCommitmentPoint::new(&context.holder_signer, &context.secp_ctx),
1424
1425
};
1425
1426
let unfunded_chan = OutboundV1Channel {
1427
+ funding,
1426
1428
context,
1427
1429
unfunded_context,
1428
1430
signer_pending_open_channel: false,
@@ -1541,6 +1543,12 @@ impl UnfundedChannelContext {
1541
1543
}
1542
1544
}
1543
1545
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
+
1544
1552
/// Contains everything about the channel including state, and various flags.
1545
1553
pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
1546
1554
config: LegacyChannelConfig,
@@ -2185,6 +2193,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
2185
2193
match self.unfunded_context.holder_commitment_point {
2186
2194
Some(holder_commitment_point) => {
2187
2195
let funded_chan = FundedChannel {
2196
+ funding: self.funding,
2188
2197
context: self.context,
2189
2198
interactive_tx_signing_session: Some(signing_session),
2190
2199
holder_commitment_point,
@@ -2222,7 +2231,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2222
2231
msg_channel_reserve_satoshis: u64,
2223
2232
msg_push_msat: u64,
2224
2233
open_channel_fields: msgs::CommonOpenChannelFields,
2225
- ) -> Result<ChannelContext<SP>, ChannelError>
2234
+ ) -> Result<(FundingScope, ChannelContext<SP>) , ChannelError>
2226
2235
where
2227
2236
ES::Target: EntropySource,
2228
2237
F::Target: FeeEstimator,
@@ -2396,6 +2405,8 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2396
2405
2397
2406
// TODO(dual_funding): Checks for `funding_feerate_sat_per_1000_weight`?
2398
2407
2408
+ let funding = FundingScope {
2409
+ };
2399
2410
let channel_context = ChannelContext {
2400
2411
user_id,
2401
2412
@@ -2540,7 +2551,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2540
2551
next_funding_txid: None,
2541
2552
};
2542
2553
2543
- Ok(channel_context)
2554
+ Ok((funding, channel_context) )
2544
2555
}
2545
2556
2546
2557
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 {
2561
2572
holder_signer: <SP::Target as SignerProvider>::EcdsaSigner,
2562
2573
pubkeys: ChannelPublicKeys,
2563
2574
_logger: L,
2564
- ) -> Result<ChannelContext<SP>, APIError>
2575
+ ) -> Result<(FundingScope, ChannelContext<SP>) , APIError>
2565
2576
where
2566
2577
ES::Target: EntropySource,
2567
2578
F::Target: FeeEstimator,
@@ -2627,7 +2638,9 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2627
2638
2628
2639
let temporary_channel_id = temporary_channel_id.unwrap_or_else(|| ChannelId::temporary_from_entropy_source(entropy_source));
2629
2640
2630
- Ok(Self {
2641
+ let funding = FundingScope {
2642
+ };
2643
+ let channel_context = Self {
2631
2644
user_id,
2632
2645
2633
2646
config: LegacyChannelConfig {
@@ -2765,7 +2778,9 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2765
2778
local_initiated_shutdown: None,
2766
2779
is_manual_broadcast: false,
2767
2780
next_funding_txid: None,
2768
- })
2781
+ };
2782
+
2783
+ Ok((funding, channel_context))
2769
2784
}
2770
2785
2771
2786
pub(crate) fn get_value_to_self_msat(&self) -> u64 {self.value_to_self_msat}
@@ -4534,6 +4549,7 @@ pub(super) struct DualFundingChannelContext {
4534
4549
// Holder designates channel data owned for the benefit of the user client.
4535
4550
// Counterparty designates channel data owned by the another channel participant entity.
4536
4551
pub(super) struct FundedChannel<SP: Deref> where SP::Target: SignerProvider {
4552
+ pub funding: FundingScope,
4537
4553
pub context: ChannelContext<SP>,
4538
4554
pub interactive_tx_signing_session: Option<InteractiveTxSigningSession>,
4539
4555
holder_commitment_point: HolderCommitmentPoint,
@@ -8550,6 +8566,7 @@ impl<SP: Deref> FundedChannel<SP> where
8550
8566
8551
8567
/// A not-yet-funded outbound (from holder) channel using V1 channel establishment.
8552
8568
pub(super) struct OutboundV1Channel<SP: Deref> where SP::Target: SignerProvider {
8569
+ pub funding: FundingScope,
8553
8570
pub context: ChannelContext<SP>,
8554
8571
pub unfunded_context: UnfundedChannelContext,
8555
8572
/// 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 {
8581
8598
let holder_signer = signer_provider.derive_channel_signer(channel_value_satoshis, channel_keys_id);
8582
8599
let pubkeys = holder_signer.pubkeys().clone();
8583
8600
8584
- let context = ChannelContext::new_for_outbound_channel(
8601
+ let (funding, context) = ChannelContext::new_for_outbound_channel(
8585
8602
fee_estimator,
8586
8603
entropy_source,
8587
8604
signer_provider,
@@ -8607,7 +8624,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
8607
8624
8608
8625
// We initialize `signer_pending_open_channel` to false, and leave setting the flag
8609
8626
// 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 };
8611
8628
Ok(chan)
8612
8629
}
8613
8630
@@ -8807,6 +8824,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
8807
8824
log_info!(logger, "Received funding_signed from peer for channel {}", &self.context.channel_id());
8808
8825
8809
8826
let mut channel = FundedChannel {
8827
+ funding: self.funding,
8810
8828
context: self.context,
8811
8829
interactive_tx_signing_session: None,
8812
8830
holder_commitment_point,
@@ -8847,6 +8865,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
8847
8865
8848
8866
/// A not-yet-funded inbound (from counterparty) channel using V1 channel establishment.
8849
8867
pub(super) struct InboundV1Channel<SP: Deref> where SP::Target: SignerProvider {
8868
+ pub funding: FundingScope,
8850
8869
pub context: ChannelContext<SP>,
8851
8870
pub unfunded_context: UnfundedChannelContext,
8852
8871
pub signer_pending_accept_channel: bool,
@@ -8915,7 +8934,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
8915
8934
htlc_basepoint: HtlcBasepoint::from(msg.common_fields.htlc_basepoint)
8916
8935
};
8917
8936
8918
- let context = ChannelContext::new_for_inbound_channel(
8937
+ let (funding, context) = ChannelContext::new_for_inbound_channel(
8919
8938
fee_estimator,
8920
8939
entropy_source,
8921
8940
signer_provider,
@@ -8939,7 +8958,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
8939
8958
unfunded_channel_age_ticks: 0,
8940
8959
holder_commitment_point: HolderCommitmentPoint::new(&context.holder_signer, &context.secp_ctx),
8941
8960
};
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 };
8943
8962
Ok(chan)
8944
8963
}
8945
8964
@@ -9072,6 +9091,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
9072
9091
// Promote the channel to a full-fledged one now that we have updated the state and have a
9073
9092
// `ChannelMonitor`.
9074
9093
let mut channel = FundedChannel {
9094
+ funding: self.funding,
9075
9095
context: self.context,
9076
9096
interactive_tx_signing_session: None,
9077
9097
holder_commitment_point,
@@ -9105,6 +9125,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
9105
9125
9106
9126
// A not-yet-funded channel using V2 channel establishment.
9107
9127
pub(super) struct PendingV2Channel<SP: Deref> where SP::Target: SignerProvider {
9128
+ pub funding: FundingScope,
9108
9129
pub context: ChannelContext<SP>,
9109
9130
pub unfunded_context: UnfundedChannelContext,
9110
9131
pub dual_funding_context: DualFundingChannelContext,
@@ -9141,7 +9162,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
9141
9162
"Provided current chain height of {} doesn't make sense for a height-based timelock for the funding transaction",
9142
9163
current_chain_height) })?;
9143
9164
9144
- let context = ChannelContext::new_for_outbound_channel(
9165
+ let (funding, context) = ChannelContext::new_for_outbound_channel(
9145
9166
fee_estimator,
9146
9167
entropy_source,
9147
9168
signer_provider,
@@ -9165,6 +9186,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
9165
9186
holder_commitment_point: HolderCommitmentPoint::new(&context.holder_signer, &context.secp_ctx),
9166
9187
};
9167
9188
let chan = Self {
9189
+ funding,
9168
9190
context,
9169
9191
unfunded_context,
9170
9192
dual_funding_context: DualFundingChannelContext {
@@ -9291,7 +9313,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
9291
9313
htlc_basepoint: HtlcBasepoint(msg.common_fields.htlc_basepoint)
9292
9314
};
9293
9315
9294
- let mut context = ChannelContext::new_for_inbound_channel(
9316
+ let (funding, mut context) = ChannelContext::new_for_inbound_channel(
9295
9317
fee_estimator,
9296
9318
entropy_source,
9297
9319
signer_provider,
@@ -9347,6 +9369,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
9347
9369
holder_commitment_point: HolderCommitmentPoint::new(&context.holder_signer, &context.secp_ctx),
9348
9370
};
9349
9371
Ok(Self {
9372
+ funding,
9350
9373
context,
9351
9374
dual_funding_context,
9352
9375
interactive_tx_constructor,
@@ -10320,6 +10343,8 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
10320
10343
};
10321
10344
10322
10345
Ok(FundedChannel {
10346
+ funding: FundingScope {
10347
+ },
10323
10348
context: ChannelContext {
10324
10349
user_id,
10325
10350
0 commit comments