@@ -1562,6 +1562,10 @@ pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
15621562 /// If we can't release a [`ChannelMonitorUpdate`] until some external action completes, we
15631563 /// store it here and only release it to the `ChannelManager` once it asks for it.
15641564 blocked_monitor_updates: Vec<PendingChannelMonitorUpdate>,
1565+ // If we've sent `commtiment_signed` for an interactive transaction construction,
1566+ // but have not received `tx_signatures` we MUST set `next_funding_txid` to the
1567+ // txid of that interactive transaction, else we MUST NOT set it.
1568+ next_funding_txid: Option<Txid>,
15651569}
15661570
15671571#[cfg(any(dual_funding, splicing))]
@@ -2126,6 +2130,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
21262130 local_initiated_shutdown: None,
21272131
21282132 blocked_monitor_updates: Vec::new(),
2133+ next_funding_txid: None,
21292134 };
21302135
21312136 Ok(channel_context)
@@ -2346,6 +2351,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
23462351
23472352 blocked_monitor_updates: Vec::new(),
23482353 local_initiated_shutdown: None,
2354+ next_funding_txid: None,
23492355 })
23502356 }
23512357
@@ -4519,6 +4525,16 @@ impl<SP: Deref> Channel<SP> where
45194525 self.context.channel_state.clear_waiting_for_batch();
45204526 }
45214527
4528+ #[cfg(any(dual_funding, splicing))]
4529+ pub fn set_next_funding_txid(&mut self, txid: &Txid) {
4530+ self.context.next_funding_txid = Some(*txid);
4531+ }
4532+
4533+ #[cfg(any(dual_funding, splicing))]
4534+ pub fn clear_next_funding_txid(&mut self) {
4535+ self.context.next_funding_txid = None;
4536+ }
4537+
45224538 /// Unsets the existing funding information.
45234539 ///
45244540 /// This must only be used if the channel has not yet completed funding and has not been used.
@@ -7505,10 +7521,7 @@ impl<SP: Deref> Channel<SP> where
75057521 next_remote_commitment_number: INITIAL_COMMITMENT_NUMBER - self.context.cur_counterparty_commitment_transaction_number - 1,
75067522 your_last_per_commitment_secret: remote_last_secret,
75077523 my_current_per_commitment_point: dummy_pubkey,
7508- // TODO(dual_funding): If we've sent `commtiment_signed` for an interactive transaction
7509- // construction but have not received `tx_signatures` we MUST set `next_funding_txid` to the
7510- // txid of that interactive transaction, else we MUST NOT set it.
7511- next_funding_txid: None,
7524+ next_funding_txid: self.context.next_funding_txid,
75127525 }
75137526 }
75147527
@@ -9435,6 +9448,7 @@ impl<SP: Deref> Writeable for Channel<SP> where SP::Target: SignerProvider {
94359448 (43, malformed_htlcs, optional_vec), // Added in 0.0.119
94369449 // 45 and 47 are reserved for async signing
94379450 (49, self.context.local_initiated_shutdown, option), // Added in 0.0.122
9451+ (51, self.context.next_funding_txid, option), // Added in 0.0.124
94389452 });
94399453
94409454 Ok(())
@@ -10010,6 +10024,10 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
1001010024 local_initiated_shutdown,
1001110025
1001210026 blocked_monitor_updates: blocked_monitor_updates.unwrap(),
10027+ // If we've sent `commtiment_signed` for an interactive transaction construction,
10028+ // but have not received `tx_signatures` we MUST set `next_funding_txid` to the
10029+ // txid of that interactive transaction, else we MUST NOT set it.
10030+ next_funding_txid: None,
1001310031 },
1001410032 #[cfg(any(dual_funding, splicing))]
1001510033 dual_funding_channel_context: None,
0 commit comments