@@ -1514,6 +1514,7 @@ impl<SP: Deref> Channel<SP> where
15141514 };
15151515 let mut funded_channel = FundedChannel {
15161516 funding: chan.funding,
1517+ pending_funding: vec![],
15171518 context: chan.context,
15181519 interactive_tx_signing_session: chan.interactive_tx_signing_session,
15191520 holder_commitment_point,
@@ -1660,6 +1661,30 @@ pub(super) struct FundingScope {
16601661 funding_transaction: Option<Transaction>,
16611662}
16621663
1664+ #[cfg(not(any(test, fuzzing)))]
1665+ impl_writeable_tlv_based!(FundingScope, {
1666+ (0, value_to_self_msat, required),
1667+ (1, counterparty_selected_channel_reserve_satoshis, option),
1668+ (2, holder_selected_channel_reserve_satoshis, required),
1669+ (3, holder_max_commitment_tx_output, required),
1670+ (4, counterparty_max_commitment_tx_output, required),
1671+ (5, channel_transaction_parameters, (required: ReadableArgs, 0)), // FIXME: This won't work
1672+ (6, funding_transaction, option),
1673+ });
1674+
1675+ #[cfg(any(test, fuzzing))]
1676+ impl_writeable_tlv_based!(FundingScope, {
1677+ (0, value_to_self_msat, required),
1678+ (1, counterparty_selected_channel_reserve_satoshis, option),
1679+ (2, holder_selected_channel_reserve_satoshis, required),
1680+ (3, holder_max_commitment_tx_output, required),
1681+ (4, counterparty_max_commitment_tx_output, required),
1682+ (5, channel_transaction_parameters, (required: ReadableArgs, 0)),
1683+ (6, funding_transaction, option),
1684+ (126, next_local_commitment_tx_fee_info_cached, required), // FIXME: This won't work
1685+ (127, next_remote_commitment_tx_fee_info_cached, required), // FIXME: This won't work
1686+ });
1687+
16631688impl FundingScope {
16641689 pub fn get_value_satoshis(&self) -> u64 {
16651690 self.channel_transaction_parameters.channel_value_satoshis
@@ -4890,6 +4915,7 @@ pub(super) struct DualFundingChannelContext {
48904915// Counterparty designates channel data owned by the another channel participant entity.
48914916pub(super) struct FundedChannel<SP: Deref> where SP::Target: SignerProvider {
48924917 pub funding: FundingScope,
4918+ pending_funding: Vec<FundingScope>,
48934919 pub context: ChannelContext<SP>,
48944920 pub interactive_tx_signing_session: Option<InteractiveTxSigningSession>,
48954921 holder_commitment_point: HolderCommitmentPoint,
@@ -9472,6 +9498,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
94729498
94739499 let mut channel = FundedChannel {
94749500 funding: self.funding,
9501+ pending_funding: vec![],
94759502 context: self.context,
94769503 interactive_tx_signing_session: None,
94779504 is_v2_established: false,
@@ -9748,6 +9775,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
97489775 // `ChannelMonitor`.
97499776 let mut channel = FundedChannel {
97509777 funding: self.funding,
9778+ pending_funding: vec![],
97519779 context: self.context,
97529780 interactive_tx_signing_session: None,
97539781 is_v2_established: false,
@@ -10542,6 +10570,7 @@ impl<SP: Deref> Writeable for FundedChannel<SP> where SP::Target: SignerProvider
1054210570 (49, self.context.local_initiated_shutdown, option), // Added in 0.0.122
1054310571 (51, is_manual_broadcast, option), // Added in 0.0.124
1054410572 (53, funding_tx_broadcast_safe_event_emitted, option), // Added in 0.0.124
10573+ (55, self.pending_funding, optional_vec), // Added in 0.2
1054510574 });
1054610575
1054710576 Ok(())
@@ -10833,6 +10862,8 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1083310862 let mut next_holder_commitment_point_opt: Option<PublicKey> = None;
1083410863 let mut is_manual_broadcast = None;
1083510864
10865+ let mut pending_funding = Some(Vec::new());
10866+
1083610867 read_tlv_fields!(reader, {
1083710868 (0, announcement_sigs, option),
1083810869 (1, minimum_depth, option),
@@ -10868,6 +10899,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1086810899 (49, local_initiated_shutdown, option),
1086910900 (51, is_manual_broadcast, option),
1087010901 (53, funding_tx_broadcast_safe_event_emitted, option),
10902+ (55, pending_funding, optional_vec), // Added in 0.2
1087110903 });
1087210904
1087310905 let holder_signer = signer_provider.derive_channel_signer(channel_keys_id);
@@ -11009,6 +11041,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1100911041 channel_transaction_parameters: channel_parameters,
1101011042 funding_transaction,
1101111043 },
11044+ pending_funding: pending_funding.unwrap(),
1101211045 context: ChannelContext {
1101311046 user_id,
1101411047
0 commit comments