@@ -1375,6 +1375,10 @@ pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
13751375 /// If we can't release a [`ChannelMonitorUpdate`] until some external action completes, we
13761376 /// store it here and only release it to the `ChannelManager` once it asks for it.
13771377 blocked_monitor_updates: Vec<PendingChannelMonitorUpdate>,
1378+ // If we've sent `commtiment_signed` for an interactive transaction construction,
1379+ // but have not received `tx_signatures` we MUST set `next_funding_txid` to the
1380+ // txid of that interactive transaction, else we MUST NOT set it.
1381+ next_funding_txid: Option<Txid>,
13781382}
13791383
13801384#[cfg(any(dual_funding, splicing))]
@@ -1939,6 +1943,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
19391943 local_initiated_shutdown: None,
19401944
19411945 blocked_monitor_updates: Vec::new(),
1946+ next_funding_txid: None,
19421947 };
19431948
19441949 Ok(channel_context)
@@ -2159,6 +2164,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
21592164
21602165 blocked_monitor_updates: Vec::new(),
21612166 local_initiated_shutdown: None,
2167+ next_funding_txid: None,
21622168 })
21632169 }
21642170
@@ -4332,6 +4338,16 @@ impl<SP: Deref> Channel<SP> where
43324338 self.context.channel_state.clear_waiting_for_batch();
43334339 }
43344340
4341+ #[cfg(any(dual_funding, splicing))]
4342+ pub fn set_next_funding_txid(&mut self, txid: &Txid) {
4343+ self.context.next_funding_txid = Some(*txid);
4344+ }
4345+
4346+ #[cfg(any(dual_funding, splicing))]
4347+ pub fn clear_next_funding_txid(&mut self) {
4348+ self.context.next_funding_txid = None;
4349+ }
4350+
43354351 /// Unsets the existing funding information.
43364352 ///
43374353 /// This must only be used if the channel has not yet completed funding and has not been used.
@@ -7318,10 +7334,7 @@ impl<SP: Deref> Channel<SP> where
73187334 next_remote_commitment_number: INITIAL_COMMITMENT_NUMBER - self.context.cur_counterparty_commitment_transaction_number - 1,
73197335 your_last_per_commitment_secret: remote_last_secret,
73207336 my_current_per_commitment_point: dummy_pubkey,
7321- // TODO(dual_funding): If we've sent `commtiment_signed` for an interactive transaction
7322- // construction but have not received `tx_signatures` we MUST set `next_funding_txid` to the
7323- // txid of that interactive transaction, else we MUST NOT set it.
7324- next_funding_txid: None,
7337+ next_funding_txid: self.context.next_funding_txid,
73257338 }
73267339 }
73277340
@@ -9248,6 +9261,7 @@ impl<SP: Deref> Writeable for Channel<SP> where SP::Target: SignerProvider {
92489261 (43, malformed_htlcs, optional_vec), // Added in 0.0.119
92499262 // 45 and 47 are reserved for async signing
92509263 (49, self.context.local_initiated_shutdown, option), // Added in 0.0.122
9264+ (51, self.context.next_funding_txid, option), // Added in 0.0.124
92519265 });
92529266
92539267 Ok(())
@@ -9823,6 +9837,10 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
98239837 local_initiated_shutdown,
98249838
98259839 blocked_monitor_updates: blocked_monitor_updates.unwrap(),
9840+ // If we've sent `commtiment_signed` for an interactive transaction construction,
9841+ // but have not received `tx_signatures` we MUST set `next_funding_txid` to the
9842+ // txid of that interactive transaction, else we MUST NOT set it.
9843+ next_funding_txid: None,
98269844 },
98279845 #[cfg(any(dual_funding, splicing))]
98289846 dual_funding_channel_context: None,
0 commit comments