@@ -1375,6 +1375,10 @@ pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
1375
1375
/// If we can't release a [`ChannelMonitorUpdate`] until some external action completes, we
1376
1376
/// store it here and only release it to the `ChannelManager` once it asks for it.
1377
1377
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>,
1378
1382
}
1379
1383
1380
1384
#[cfg(any(dual_funding, splicing))]
@@ -1939,6 +1943,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
1939
1943
local_initiated_shutdown: None,
1940
1944
1941
1945
blocked_monitor_updates: Vec::new(),
1946
+ next_funding_txid: None,
1942
1947
};
1943
1948
1944
1949
Ok(channel_context)
@@ -2159,6 +2164,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2159
2164
2160
2165
blocked_monitor_updates: Vec::new(),
2161
2166
local_initiated_shutdown: None,
2167
+ next_funding_txid: None,
2162
2168
})
2163
2169
}
2164
2170
@@ -4332,6 +4338,16 @@ impl<SP: Deref> Channel<SP> where
4332
4338
self.context.channel_state.clear_waiting_for_batch();
4333
4339
}
4334
4340
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
+
4335
4351
/// Unsets the existing funding information.
4336
4352
///
4337
4353
/// 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
7318
7334
next_remote_commitment_number: INITIAL_COMMITMENT_NUMBER - self.context.cur_counterparty_commitment_transaction_number - 1,
7319
7335
your_last_per_commitment_secret: remote_last_secret,
7320
7336
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,
7325
7338
}
7326
7339
}
7327
7340
@@ -9248,6 +9261,7 @@ impl<SP: Deref> Writeable for Channel<SP> where SP::Target: SignerProvider {
9248
9261
(43, malformed_htlcs, optional_vec), // Added in 0.0.119
9249
9262
// 45 and 47 are reserved for async signing
9250
9263
(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
9251
9265
});
9252
9266
9253
9267
Ok(())
@@ -9823,6 +9837,10 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
9823
9837
local_initiated_shutdown,
9824
9838
9825
9839
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,
9826
9844
},
9827
9845
#[cfg(any(dual_funding, splicing))]
9828
9846
dual_funding_channel_context: None,
0 commit comments