@@ -1493,6 +1493,10 @@ pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
14931493 /// If we can't release a [`ChannelMonitorUpdate`] until some external action completes, we
14941494 /// store it here and only release it to the `ChannelManager` once it asks for it.
14951495 blocked_monitor_updates: Vec<PendingChannelMonitorUpdate>,
1496+ // If we've sent `commtiment_signed` for an interactive transaction construction,
1497+ // but have not received `tx_signatures` we MUST set `next_funding_txid` to the
1498+ // txid of that interactive transaction, else we MUST NOT set it.
1499+ next_funding_txid: Option<Txid>,
14961500}
14971501
14981502/// A channel struct implementing this trait can receive an initial counterparty commitment
@@ -2148,6 +2152,8 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
21482152 blocked_monitor_updates: Vec::new(),
21492153
21502154 is_manual_broadcast: false,
2155+
2156+ next_funding_txid: None,
21512157 };
21522158
21532159 Ok(channel_context)
@@ -2379,6 +2385,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
23792385 blocked_monitor_updates: Vec::new(),
23802386 local_initiated_shutdown: None,
23812387 is_manual_broadcast: false,
2388+ next_funding_txid: None,
23822389 })
23832390 }
23842391
@@ -4584,6 +4591,14 @@ impl<SP: Deref> Channel<SP> where
45844591 self.context.channel_state.clear_waiting_for_batch();
45854592 }
45864593
4594+ pub fn set_next_funding_txid(&mut self, txid: &Txid) {
4595+ self.context.next_funding_txid = Some(*txid);
4596+ }
4597+
4598+ pub fn clear_next_funding_txid(&mut self) {
4599+ self.context.next_funding_txid = None;
4600+ }
4601+
45874602 /// Unsets the existing funding information.
45884603 ///
45894604 /// This must only be used if the channel has not yet completed funding and has not been used.
@@ -7665,10 +7680,7 @@ impl<SP: Deref> Channel<SP> where
76657680 next_remote_commitment_number: INITIAL_COMMITMENT_NUMBER - self.context.cur_counterparty_commitment_transaction_number - 1,
76667681 your_last_per_commitment_secret: remote_last_secret,
76677682 my_current_per_commitment_point: dummy_pubkey,
7668- // TODO(dual_funding): If we've sent `commtiment_signed` for an interactive transaction
7669- // construction but have not received `tx_signatures` we MUST set `next_funding_txid` to the
7670- // txid of that interactive transaction, else we MUST NOT set it.
7671- next_funding_txid: None,
7683+ next_funding_txid: self.context.next_funding_txid,
76727684 }
76737685 }
76747686
@@ -9450,7 +9462,8 @@ impl<SP: Deref> Writeable for Channel<SP> where SP::Target: SignerProvider {
94509462 (47, next_holder_commitment_point, option),
94519463 (49, self.context.local_initiated_shutdown, option), // Added in 0.0.122
94529464 (51, is_manual_broadcast, option), // Added in 0.0.124
9453- (53, funding_tx_broadcast_safe_event_emitted, option) // Added in 0.0.124
9465+ (53, funding_tx_broadcast_safe_event_emitted, option), // Added in 0.0.124
9466+ (55, self.context.next_funding_txid, option) // Added in 0.0.125
94549467 });
94559468
94569469 Ok(())
@@ -9740,6 +9753,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
97409753 let mut channel_pending_event_emitted = None;
97419754 let mut channel_ready_event_emitted = None;
97429755 let mut funding_tx_broadcast_safe_event_emitted = None;
9756+ let mut next_funding_txid = None;
97439757
97449758 let mut user_id_high_opt: Option<u64> = None;
97459759 let mut channel_keys_id: Option<[u8; 32]> = None;
@@ -9800,6 +9814,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
98009814 (49, local_initiated_shutdown, option),
98019815 (51, is_manual_broadcast, option),
98029816 (53, funding_tx_broadcast_safe_event_emitted, option),
9817+ (55, next_funding_txid, option) // Added in 0.0.125
98039818 });
98049819
98059820 let (channel_keys_id, holder_signer) = if let Some(channel_keys_id) = channel_keys_id {
@@ -10059,6 +10074,10 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
1005910074
1006010075 blocked_monitor_updates: blocked_monitor_updates.unwrap(),
1006110076 is_manual_broadcast: is_manual_broadcast.unwrap_or(false),
10077+ // If we've sent `commtiment_signed` for an interactive transaction construction,
10078+ // but have not received `tx_signatures` we MUST set `next_funding_txid` to the
10079+ // txid of that interactive transaction, else we MUST NOT set it.
10080+ next_funding_txid,
1006210081 },
1006310082 dual_funding_channel_context: None,
1006410083 interactive_tx_constructor: None,
0 commit comments