@@ -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 {
@@ -1993,6 +1997,8 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
19931997 blocked_monitor_updates: Vec::new(),
19941998
19951999 is_manual_broadcast: false,
2000+
2001+ next_funding_txid: None,
19962002 };
19972003
19982004 Ok(channel_context)
@@ -2224,6 +2230,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
22242230 blocked_monitor_updates: Vec::new(),
22252231 local_initiated_shutdown: None,
22262232 is_manual_broadcast: false,
2233+ next_funding_txid: None,
22272234 })
22282235 }
22292236
@@ -4427,6 +4434,14 @@ impl<SP: Deref> Channel<SP> where
44274434 self.context.channel_state.clear_waiting_for_batch();
44284435 }
44294436
4437+ pub fn set_next_funding_txid(&mut self, txid: &Txid) {
4438+ self.context.next_funding_txid = Some(*txid);
4439+ }
4440+
4441+ pub fn clear_next_funding_txid(&mut self) {
4442+ self.context.next_funding_txid = None;
4443+ }
4444+
44304445 /// Unsets the existing funding information.
44314446 ///
44324447 /// This must only be used if the channel has not yet completed funding and has not been used.
@@ -7570,10 +7585,7 @@ impl<SP: Deref> Channel<SP> where
75707585 next_remote_commitment_number: INITIAL_COMMITMENT_NUMBER - self.context.cur_counterparty_commitment_transaction_number - 1,
75717586 your_last_per_commitment_secret: remote_last_secret,
75727587 my_current_per_commitment_point: dummy_pubkey,
7573- // TODO(dual_funding): If we've sent `commtiment_signed` for an interactive transaction
7574- // construction but have not received `tx_signatures` we MUST set `next_funding_txid` to the
7575- // txid of that interactive transaction, else we MUST NOT set it.
7576- next_funding_txid: None,
7588+ next_funding_txid: self.context.next_funding_txid,
75777589 }
75787590 }
75797591
@@ -9476,7 +9488,8 @@ impl<SP: Deref> Writeable for Channel<SP> where SP::Target: SignerProvider {
94769488 (47, next_holder_commitment_point, option),
94779489 (49, self.context.local_initiated_shutdown, option), // Added in 0.0.122
94789490 (51, is_manual_broadcast, option), // Added in 0.0.124
9479- (53, funding_tx_broadcast_safe_event_emitted, option) // Added in 0.0.124
9491+ (53, funding_tx_broadcast_safe_event_emitted, option), // Added in 0.0.124
9492+ (55, self.context.next_funding_txid, option) // Added in 0.0.125
94809493 });
94819494
94829495 Ok(())
@@ -10085,6 +10098,10 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
1008510098
1008610099 blocked_monitor_updates: blocked_monitor_updates.unwrap(),
1008710100 is_manual_broadcast: is_manual_broadcast.unwrap_or(false),
10101+ // If we've sent `commtiment_signed` for an interactive transaction construction,
10102+ // but have not received `tx_signatures` we MUST set `next_funding_txid` to the
10103+ // txid of that interactive transaction, else we MUST NOT set it.
10104+ next_funding_txid: None,
1008810105 },
1008910106 dual_funding_channel_context: None,
1009010107 interactive_tx_constructor: None,
0 commit comments