@@ -1650,6 +1650,10 @@ pub(super) struct FundingScope {
1650
1650
next_remote_commitment_tx_fee_info_cached: Mutex<Option<CommitmentTxInfoCached>>,
1651
1651
1652
1652
pub(super) channel_transaction_parameters: ChannelTransactionParameters,
1653
+
1654
+ /// The transaction which funds this channel. Note that for manually-funded channels (i.e.,
1655
+ /// [`ChannelContext::is_manual_broadcast`] is true) this will be a dummy empty transaction.
1656
+ funding_transaction: Option<Transaction>,
1653
1657
}
1654
1658
1655
1659
impl FundingScope {
@@ -1902,9 +1906,6 @@ pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
1902
1906
1903
1907
counterparty_forwarding_info: Option<CounterpartyForwardingInfo>,
1904
1908
1905
- /// The transaction which funds this channel. Note that for manually-funded channels (i.e.,
1906
- /// is_manual_broadcast is true) this will be a dummy empty transaction.
1907
- funding_transaction: Option<Transaction>,
1908
1909
/// This flag indicates that it is the user's responsibility to validated and broadcast the
1909
1910
/// funding transaction.
1910
1911
is_manual_broadcast: bool,
@@ -2321,7 +2322,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
2321
2322
let commitment_signed = self.context.get_initial_commitment_signed(&self.funding, logger);
2322
2323
let commitment_signed = match commitment_signed {
2323
2324
Ok(commitment_signed) => {
2324
- self.context .funding_transaction = Some(signing_session.unsigned_tx.build_unsigned_tx());
2325
+ self.funding .funding_transaction = Some(signing_session.unsigned_tx.build_unsigned_tx());
2325
2326
commitment_signed
2326
2327
},
2327
2328
Err(err) => {
@@ -2598,6 +2599,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2598
2599
funding_outpoint: None,
2599
2600
channel_type_features: channel_type.clone()
2600
2601
},
2602
+ funding_transaction: None,
2601
2603
};
2602
2604
let channel_context = ChannelContext {
2603
2605
user_id,
@@ -2679,7 +2681,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2679
2681
2680
2682
counterparty_forwarding_info: None,
2681
2683
2682
- funding_transaction: None,
2683
2684
is_batch_funding: None,
2684
2685
2685
2686
counterparty_cur_commitment_point: Some(open_channel_fields.first_per_commitment_point),
@@ -2833,6 +2834,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2833
2834
funding_outpoint: None,
2834
2835
channel_type_features: channel_type.clone()
2835
2836
},
2837
+ funding_transaction: None,
2836
2838
};
2837
2839
let channel_context = Self {
2838
2840
user_id,
@@ -2914,7 +2916,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2914
2916
2915
2917
counterparty_forwarding_info: None,
2916
2918
2917
- funding_transaction: None,
2918
2919
is_batch_funding: None,
2919
2920
2920
2921
counterparty_cur_commitment_point: None,
@@ -4327,8 +4328,8 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
4327
4328
///
4328
4329
/// Note that if [`Self::is_manual_broadcast`] is true the transaction will be a dummy
4329
4330
/// transaction.
4330
- pub fn unbroadcasted_funding(&self) -> Option<Transaction> {
4331
- self.if_unbroadcasted_funding(|| self .funding_transaction.clone())
4331
+ pub fn unbroadcasted_funding(&self, funding: &FundingScope ) -> Option<Transaction> {
4332
+ self.if_unbroadcasted_funding(|| funding .funding_transaction.clone())
4332
4333
}
4333
4334
4334
4335
/// Returns the transaction ID if there is a pending funding transaction that is yet to be
@@ -4392,8 +4393,8 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
4392
4393
}))
4393
4394
} else { None }
4394
4395
} else { None };
4395
- let unbroadcasted_batch_funding_txid = self.unbroadcasted_batch_funding_txid(& funding);
4396
- let unbroadcasted_funding_tx = self.unbroadcasted_funding();
4396
+ let unbroadcasted_batch_funding_txid = self.unbroadcasted_batch_funding_txid(funding);
4397
+ let unbroadcasted_funding_tx = self.unbroadcasted_funding(funding );
4397
4398
4398
4399
self.channel_state = ChannelState::ShutdownComplete;
4399
4400
self.update_time_counter += 1;
@@ -6219,7 +6220,7 @@ impl<SP: Deref> FundedChannel<SP> where
6219
6220
if funding_tx_opt.is_some() {
6220
6221
// We have a finalized funding transaction, so we can set the funding transaction and reset the
6221
6222
// signing session fields.
6222
- self.context .funding_transaction = funding_tx_opt;
6223
+ self.funding .funding_transaction = funding_tx_opt;
6223
6224
self.context.next_funding_txid = None;
6224
6225
self.interactive_tx_signing_session = None;
6225
6226
}
@@ -6451,7 +6452,7 @@ impl<SP: Deref> FundedChannel<SP> where
6451
6452
// try to (re-)broadcast the funding transaction as we may have declined to broadcast it when we
6452
6453
// first received the funding_signed.
6453
6454
let mut funding_broadcastable = None;
6454
- if let Some(funding_transaction) = &self.context .funding_transaction {
6455
+ if let Some(funding_transaction) = &self.funding .funding_transaction {
6455
6456
if (self.funding.is_outbound() || self.is_v2_established()) &&
6456
6457
(matches!(self.context.channel_state, ChannelState::AwaitingChannelReady(flags) if !flags.is_set(AwaitingChannelReadyFlags::WAITING_FOR_BATCH)) ||
6457
6458
matches!(self.context.channel_state, ChannelState::ChannelReady(_)))
@@ -7326,7 +7327,7 @@ impl<SP: Deref> FundedChannel<SP> where
7326
7327
user_channel_id: self.context.user_id,
7327
7328
channel_capacity_satoshis: self.funding.channel_value_satoshis,
7328
7329
counterparty_node_id: self.context.counterparty_node_id,
7329
- unbroadcasted_funding_tx: self.context.unbroadcasted_funding(),
7330
+ unbroadcasted_funding_tx: self.context.unbroadcasted_funding(&self.funding ),
7330
7331
is_manual_broadcast: self.context.is_manual_broadcast,
7331
7332
channel_funding_txo: self.funding.get_funding_txo(),
7332
7333
last_local_balance_msat: self.funding.value_to_self_msat,
@@ -7734,7 +7735,7 @@ impl<SP: Deref> FundedChannel<SP> where
7734
7735
// Because deciding we're awaiting initial broadcast spuriously could result in
7735
7736
// funds-loss (as we don't have a monitor, but have the funding transaction confirmed),
7736
7737
// we hard-assert here, even in production builds.
7737
- if self.funding.is_outbound() { assert!(self.context .funding_transaction.is_some()); }
7738
+ if self.funding.is_outbound() { assert!(self.funding .funding_transaction.is_some()); }
7738
7739
assert!(self.context.monitor_pending_channel_ready);
7739
7740
assert_eq!(self.context.latest_monitor_update_id, 0);
7740
7741
return true;
@@ -9109,8 +9110,8 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
9109
9110
self.context.minimum_depth = Some(COINBASE_MATURITY);
9110
9111
}
9111
9112
9112
- debug_assert!(self.context .funding_transaction.is_none());
9113
- self.context .funding_transaction = Some(funding_transaction);
9113
+ debug_assert!(self.funding .funding_transaction.is_none());
9114
+ self.funding .funding_transaction = Some(funding_transaction);
9114
9115
self.context.is_batch_funding = Some(()).filter(|_| is_batch_funding);
9115
9116
9116
9117
let funding_created = self.get_funding_created_msg(logger);
@@ -10195,7 +10196,7 @@ impl<SP: Deref> Writeable for FundedChannel<SP> where SP::Target: SignerProvider
10195
10196
}
10196
10197
10197
10198
self.funding.channel_transaction_parameters.write(writer)?;
10198
- self.context .funding_transaction.write(writer)?;
10199
+ self.funding .funding_transaction.write(writer)?;
10199
10200
10200
10201
self.context.counterparty_cur_commitment_point.write(writer)?;
10201
10202
self.context.counterparty_prev_commitment_point.write(writer)?;
@@ -10782,6 +10783,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
10782
10783
next_remote_commitment_tx_fee_info_cached: Mutex::new(None),
10783
10784
10784
10785
channel_transaction_parameters: channel_parameters,
10786
+ funding_transaction,
10785
10787
},
10786
10788
context: ChannelContext {
10787
10789
user_id,
@@ -10860,7 +10862,6 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
10860
10862
10861
10863
counterparty_forwarding_info,
10862
10864
10863
- funding_transaction,
10864
10865
is_batch_funding,
10865
10866
10866
10867
counterparty_cur_commitment_point,
0 commit comments