@@ -1450,6 +1450,10 @@ pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
14501450 /// If we can't release a [`ChannelMonitorUpdate`] until some external action completes, we
14511451 /// store it here and only release it to the `ChannelManager` once it asks for it.
14521452 blocked_monitor_updates: Vec<PendingChannelMonitorUpdate>,
1453+ // If we've sent `commtiment_signed` for an interactive transaction construction,
1454+ // but have not received `tx_signatures` we MUST set `next_funding_txid` to the
1455+ // txid of that interactive transaction, else we MUST NOT set it.
1456+ next_funding_txid: Option<Txid>,
14531457}
14541458
14551459#[cfg(any(dual_funding, splicing))]
@@ -1999,6 +2003,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
19992003 local_initiated_shutdown: None,
20002004
20012005 blocked_monitor_updates: Vec::new(),
2006+ next_funding_txid: None,
20022007 };
20032008
20042009 Ok(channel_context)
@@ -2222,6 +2227,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
22222227
22232228 blocked_monitor_updates: Vec::new(),
22242229 local_initiated_shutdown: None,
2230+ next_funding_txid: None,
22252231 })
22262232 }
22272233
@@ -4397,6 +4403,16 @@ impl<SP: Deref> Channel<SP> where
43974403 self.context.channel_state.clear_waiting_for_batch();
43984404 }
43994405
4406+ #[cfg(any(dual_funding, splicing))]
4407+ pub fn set_next_funding_txid(&mut self, txid: &Txid) {
4408+ self.context.next_funding_txid = Some(*txid);
4409+ }
4410+
4411+ #[cfg(any(dual_funding, splicing))]
4412+ pub fn clear_next_funding_txid(&mut self) {
4413+ self.context.next_funding_txid = None;
4414+ }
4415+
44004416 /// Unsets the existing funding information.
44014417 ///
44024418 /// This must only be used if the channel has not yet completed funding and has not been used.
@@ -7437,10 +7453,7 @@ impl<SP: Deref> Channel<SP> where
74377453 next_remote_commitment_number: INITIAL_COMMITMENT_NUMBER - self.context.cur_counterparty_commitment_transaction_number - 1,
74387454 your_last_per_commitment_secret: remote_last_secret,
74397455 my_current_per_commitment_point: dummy_pubkey,
7440- // TODO(dual_funding): If we've sent `commtiment_signed` for an interactive transaction
7441- // construction but have not received `tx_signatures` we MUST set `next_funding_txid` to the
7442- // txid of that interactive transaction, else we MUST NOT set it.
7443- next_funding_txid: None,
7456+ next_funding_txid: self.context.next_funding_txid,
74447457 }
74457458 }
74467459
@@ -9419,6 +9432,7 @@ impl<SP: Deref> Writeable for Channel<SP> where SP::Target: SignerProvider {
94199432 (45, cur_holder_commitment_point, option),
94209433 (47, next_holder_commitment_point, option),
94219434 (49, self.context.local_initiated_shutdown, option), // Added in 0.0.122
9435+ (51, self.context.next_funding_txid, option), // Added in 0.0.124
94229436 });
94239437
94249438 Ok(())
@@ -10016,6 +10030,10 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
1001610030 local_initiated_shutdown,
1001710031
1001810032 blocked_monitor_updates: blocked_monitor_updates.unwrap(),
10033+ // If we've sent `commtiment_signed` for an interactive transaction construction,
10034+ // but have not received `tx_signatures` we MUST set `next_funding_txid` to the
10035+ // txid of that interactive transaction, else we MUST NOT set it.
10036+ next_funding_txid: None,
1001910037 },
1002010038 #[cfg(any(dual_funding, splicing))]
1002110039 dual_funding_channel_context: None,
0 commit comments