@@ -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
14981502pub(super) trait InteractivelyFunded<SP: Deref> where SP::Target: SignerProvider {
@@ -2152,6 +2156,8 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
21522156 blocked_monitor_updates: Vec::new(),
21532157
21542158 is_manual_broadcast: false,
2159+
2160+ next_funding_txid: None,
21552161 };
21562162
21572163 Ok(channel_context)
@@ -2383,6 +2389,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
23832389 blocked_monitor_updates: Vec::new(),
23842390 local_initiated_shutdown: None,
23852391 is_manual_broadcast: false,
2392+ next_funding_txid: None,
23862393 })
23872394 }
23882395
@@ -4588,6 +4595,14 @@ impl<SP: Deref> Channel<SP> where
45884595 self.context.channel_state.clear_waiting_for_batch();
45894596 }
45904597
4598+ pub fn set_next_funding_txid(&mut self, txid: &Txid) {
4599+ self.context.next_funding_txid = Some(*txid);
4600+ }
4601+
4602+ pub fn clear_next_funding_txid(&mut self) {
4603+ self.context.next_funding_txid = None;
4604+ }
4605+
45914606 /// Unsets the existing funding information.
45924607 ///
45934608 /// This must only be used if the channel has not yet completed funding and has not been used.
@@ -7669,10 +7684,7 @@ impl<SP: Deref> Channel<SP> where
76697684 next_remote_commitment_number: INITIAL_COMMITMENT_NUMBER - self.context.cur_counterparty_commitment_transaction_number - 1,
76707685 your_last_per_commitment_secret: remote_last_secret,
76717686 my_current_per_commitment_point: dummy_pubkey,
7672- // TODO(dual_funding): If we've sent `commtiment_signed` for an interactive transaction
7673- // construction but have not received `tx_signatures` we MUST set `next_funding_txid` to the
7674- // txid of that interactive transaction, else we MUST NOT set it.
7675- next_funding_txid: None,
7687+ next_funding_txid: self.context.next_funding_txid,
76767688 }
76777689 }
76787690
@@ -9452,7 +9464,8 @@ impl<SP: Deref> Writeable for Channel<SP> where SP::Target: SignerProvider {
94529464 (47, next_holder_commitment_point, option),
94539465 (49, self.context.local_initiated_shutdown, option), // Added in 0.0.122
94549466 (51, is_manual_broadcast, option), // Added in 0.0.124
9455- (53, funding_tx_broadcast_safe_event_emitted, option) // Added in 0.0.124
9467+ (53, funding_tx_broadcast_safe_event_emitted, option), // Added in 0.0.124
9468+ (55, self.context.next_funding_txid, option) // Added in 0.0.125
94569469 });
94579470
94589471 Ok(())
@@ -9742,6 +9755,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
97429755 let mut channel_pending_event_emitted = None;
97439756 let mut channel_ready_event_emitted = None;
97449757 let mut funding_tx_broadcast_safe_event_emitted = None;
9758+ let mut next_funding_txid = None;
97459759
97469760 let mut user_id_high_opt: Option<u64> = None;
97479761 let mut channel_keys_id: Option<[u8; 32]> = None;
@@ -9802,6 +9816,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
98029816 (49, local_initiated_shutdown, option),
98039817 (51, is_manual_broadcast, option),
98049818 (53, funding_tx_broadcast_safe_event_emitted, option),
9819+ (55, next_funding_txid, option) // Added in 0.0.125
98059820 });
98069821
98079822 let (channel_keys_id, holder_signer) = if let Some(channel_keys_id) = channel_keys_id {
@@ -10061,6 +10076,10 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
1006110076
1006210077 blocked_monitor_updates: blocked_monitor_updates.unwrap(),
1006310078 is_manual_broadcast: is_manual_broadcast.unwrap_or(false),
10079+ // If we've sent `commtiment_signed` for an interactive transaction construction,
10080+ // but have not received `tx_signatures` we MUST set `next_funding_txid` to the
10081+ // txid of that interactive transaction, else we MUST NOT set it.
10082+ next_funding_txid,
1006410083 },
1006510084 dual_funding_channel_context: None,
1006610085 interactive_tx_constructor: None,
0 commit comments