@@ -1522,6 +1522,12 @@ impl UnfundedChannelContext {
1522
1522
}
1523
1523
}
1524
1524
1525
+ /// Information pertaining to an attempt at funding the channel. This is typically constructed
1526
+ /// during channel establishment and may be replaced during channel splicing or if the attempted
1527
+ /// funding transaction is replaced using tx_init_rbf.
1528
+ pub(super) struct FundingScope {
1529
+ }
1530
+
1525
1531
/// Contains everything about the channel including state, and various flags.
1526
1532
pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
1527
1533
config: LegacyChannelConfig,
@@ -2166,6 +2172,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
2166
2172
match self.unfunded_context.holder_commitment_point {
2167
2173
Some(holder_commitment_point) => {
2168
2174
let funded_chan = FundedChannel {
2175
+ funding: self.funding,
2169
2176
context: self.context,
2170
2177
interactive_tx_signing_session: Some(signing_session),
2171
2178
holder_commitment_point,
@@ -2203,7 +2210,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2203
2210
msg_channel_reserve_satoshis: u64,
2204
2211
msg_push_msat: u64,
2205
2212
open_channel_fields: msgs::CommonOpenChannelFields,
2206
- ) -> Result<ChannelContext<SP>, ChannelError>
2213
+ ) -> Result<(FundingScope, ChannelContext<SP>) , ChannelError>
2207
2214
where
2208
2215
ES::Target: EntropySource,
2209
2216
F::Target: FeeEstimator,
@@ -2377,6 +2384,8 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2377
2384
2378
2385
// TODO(dual_funding): Checks for `funding_feerate_sat_per_1000_weight`?
2379
2386
2387
+ let funding = FundingScope {
2388
+ };
2380
2389
let channel_context = ChannelContext {
2381
2390
user_id,
2382
2391
@@ -2521,7 +2530,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2521
2530
next_funding_txid: None,
2522
2531
};
2523
2532
2524
- Ok(channel_context)
2533
+ Ok((funding, channel_context) )
2525
2534
}
2526
2535
2527
2536
fn new_for_outbound_channel<'a, ES: Deref, F: Deref, L: Deref>(
@@ -2542,7 +2551,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2542
2551
holder_signer: <SP::Target as SignerProvider>::EcdsaSigner,
2543
2552
pubkeys: ChannelPublicKeys,
2544
2553
_logger: L,
2545
- ) -> Result<ChannelContext<SP>, APIError>
2554
+ ) -> Result<(FundingScope, ChannelContext<SP>) , APIError>
2546
2555
where
2547
2556
ES::Target: EntropySource,
2548
2557
F::Target: FeeEstimator,
@@ -2608,7 +2617,9 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2608
2617
2609
2618
let temporary_channel_id = temporary_channel_id.unwrap_or_else(|| ChannelId::temporary_from_entropy_source(entropy_source));
2610
2619
2611
- Ok(Self {
2620
+ let funding = FundingScope {
2621
+ };
2622
+ let channel_context = Self {
2612
2623
user_id,
2613
2624
2614
2625
config: LegacyChannelConfig {
@@ -2746,7 +2757,9 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2746
2757
local_initiated_shutdown: None,
2747
2758
is_manual_broadcast: false,
2748
2759
next_funding_txid: None,
2749
- })
2760
+ };
2761
+
2762
+ Ok((funding, channel_context))
2750
2763
}
2751
2764
2752
2765
pub(crate) fn get_value_to_self_msat(&self) -> u64 {self.value_to_self_msat}
@@ -4502,6 +4515,7 @@ pub(super) struct DualFundingChannelContext {
4502
4515
// Holder designates channel data owned for the benefit of the user client.
4503
4516
// Counterparty designates channel data owned by the another channel participant entity.
4504
4517
pub(super) struct FundedChannel<SP: Deref> where SP::Target: SignerProvider {
4518
+ pub funding: FundingScope,
4505
4519
pub context: ChannelContext<SP>,
4506
4520
pub interactive_tx_signing_session: Option<InteractiveTxSigningSession>,
4507
4521
holder_commitment_point: HolderCommitmentPoint,
@@ -8518,6 +8532,7 @@ impl<SP: Deref> FundedChannel<SP> where
8518
8532
8519
8533
/// A not-yet-funded outbound (from holder) channel using V1 channel establishment.
8520
8534
pub(super) struct OutboundV1Channel<SP: Deref> where SP::Target: SignerProvider {
8535
+ pub funding: FundingScope,
8521
8536
pub context: ChannelContext<SP>,
8522
8537
pub unfunded_context: UnfundedChannelContext,
8523
8538
/// We tried to send an `open_channel` message but our commitment point wasn't ready.
@@ -8549,7 +8564,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
8549
8564
let holder_signer = signer_provider.derive_channel_signer(channel_value_satoshis, channel_keys_id);
8550
8565
let pubkeys = holder_signer.pubkeys().clone();
8551
8566
8552
- let context = ChannelContext::new_for_outbound_channel(
8567
+ let (funding, context) = ChannelContext::new_for_outbound_channel(
8553
8568
fee_estimator,
8554
8569
entropy_source,
8555
8570
signer_provider,
@@ -8575,7 +8590,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
8575
8590
8576
8591
// We initialize `signer_pending_open_channel` to false, and leave setting the flag
8577
8592
// for when we try to generate the open_channel message.
8578
- let chan = Self { context, unfunded_context, signer_pending_open_channel: false };
8593
+ let chan = Self { funding, context, unfunded_context, signer_pending_open_channel: false };
8579
8594
Ok(chan)
8580
8595
}
8581
8596
@@ -8775,6 +8790,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
8775
8790
log_info!(logger, "Received funding_signed from peer for channel {}", &self.context.channel_id());
8776
8791
8777
8792
let mut channel = FundedChannel {
8793
+ funding: self.funding,
8778
8794
context: self.context,
8779
8795
interactive_tx_signing_session: None,
8780
8796
holder_commitment_point,
@@ -8815,6 +8831,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
8815
8831
8816
8832
/// A not-yet-funded inbound (from counterparty) channel using V1 channel establishment.
8817
8833
pub(super) struct InboundV1Channel<SP: Deref> where SP::Target: SignerProvider {
8834
+ pub funding: FundingScope,
8818
8835
pub context: ChannelContext<SP>,
8819
8836
pub unfunded_context: UnfundedChannelContext,
8820
8837
pub signer_pending_accept_channel: bool,
@@ -8883,7 +8900,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
8883
8900
htlc_basepoint: HtlcBasepoint::from(msg.common_fields.htlc_basepoint)
8884
8901
};
8885
8902
8886
- let context = ChannelContext::new_for_inbound_channel(
8903
+ let (funding, context) = ChannelContext::new_for_inbound_channel(
8887
8904
fee_estimator,
8888
8905
entropy_source,
8889
8906
signer_provider,
@@ -8907,7 +8924,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
8907
8924
unfunded_channel_age_ticks: 0,
8908
8925
holder_commitment_point: HolderCommitmentPoint::new(&context.holder_signer, &context.secp_ctx),
8909
8926
};
8910
- let chan = Self { context, unfunded_context, signer_pending_accept_channel: false };
8927
+ let chan = Self { funding, context, unfunded_context, signer_pending_accept_channel: false };
8911
8928
Ok(chan)
8912
8929
}
8913
8930
@@ -9040,6 +9057,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
9040
9057
// Promote the channel to a full-fledged one now that we have updated the state and have a
9041
9058
// `ChannelMonitor`.
9042
9059
let mut channel = FundedChannel {
9060
+ funding: self.funding,
9043
9061
context: self.context,
9044
9062
interactive_tx_signing_session: None,
9045
9063
holder_commitment_point,
@@ -9073,6 +9091,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
9073
9091
9074
9092
// A not-yet-funded channel using V2 channel establishment.
9075
9093
pub(super) struct PendingV2Channel<SP: Deref> where SP::Target: SignerProvider {
9094
+ pub funding: FundingScope,
9076
9095
pub context: ChannelContext<SP>,
9077
9096
pub unfunded_context: UnfundedChannelContext,
9078
9097
pub dual_funding_context: DualFundingChannelContext,
@@ -9109,7 +9128,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
9109
9128
"Provided current chain height of {} doesn't make sense for a height-based timelock for the funding transaction",
9110
9129
current_chain_height) })?;
9111
9130
9112
- let context = ChannelContext::new_for_outbound_channel(
9131
+ let (funding, context) = ChannelContext::new_for_outbound_channel(
9113
9132
fee_estimator,
9114
9133
entropy_source,
9115
9134
signer_provider,
@@ -9133,6 +9152,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
9133
9152
holder_commitment_point: HolderCommitmentPoint::new(&context.holder_signer, &context.secp_ctx),
9134
9153
};
9135
9154
let chan = Self {
9155
+ funding,
9136
9156
context,
9137
9157
unfunded_context,
9138
9158
dual_funding_context: DualFundingChannelContext {
@@ -9255,7 +9275,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
9255
9275
htlc_basepoint: HtlcBasepoint(msg.common_fields.htlc_basepoint)
9256
9276
};
9257
9277
9258
- let mut context = ChannelContext::new_for_inbound_channel(
9278
+ let (funding, mut context) = ChannelContext::new_for_inbound_channel(
9259
9279
fee_estimator,
9260
9280
entropy_source,
9261
9281
signer_provider,
@@ -9311,6 +9331,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
9311
9331
holder_commitment_point: HolderCommitmentPoint::new(&context.holder_signer, &context.secp_ctx),
9312
9332
};
9313
9333
Ok(Self {
9334
+ funding,
9314
9335
context,
9315
9336
dual_funding_context,
9316
9337
interactive_tx_constructor,
@@ -10284,6 +10305,8 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
10284
10305
};
10285
10306
10286
10307
Ok(FundedChannel {
10308
+ funding: FundingScope {
10309
+ },
10287
10310
context: ChannelContext {
10288
10311
user_id,
10289
10312
0 commit comments