@@ -1436,6 +1436,10 @@ pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
1436
1436
/// If we can't release a [`ChannelMonitorUpdate`] until some external action completes, we
1437
1437
/// store it here and only release it to the `ChannelManager` once it asks for it.
1438
1438
blocked_monitor_updates: Vec<PendingChannelMonitorUpdate>,
1439
+ // If we've sent `commtiment_signed` for an interactive transaction construction,
1440
+ // but have not received `tx_signatures` we MUST set `next_funding_txid` to the
1441
+ // txid of that interactive transaction, else we MUST NOT set it.
1442
+ next_funding_txid: Option<Txid>,
1439
1443
}
1440
1444
1441
1445
pub(super) trait InteractivelyFunded<SP: Deref> where SP::Target: SignerProvider {
@@ -1975,6 +1979,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
1975
1979
local_initiated_shutdown: None,
1976
1980
1977
1981
blocked_monitor_updates: Vec::new(),
1982
+ next_funding_txid: None,
1978
1983
};
1979
1984
1980
1985
Ok(channel_context)
@@ -2198,6 +2203,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2198
2203
2199
2204
blocked_monitor_updates: Vec::new(),
2200
2205
local_initiated_shutdown: None,
2206
+ next_funding_txid: None,
2201
2207
})
2202
2208
}
2203
2209
@@ -4370,6 +4376,14 @@ impl<SP: Deref> Channel<SP> where
4370
4376
self.context.channel_state.clear_waiting_for_batch();
4371
4377
}
4372
4378
4379
+ pub fn set_next_funding_txid(&mut self, txid: &Txid) {
4380
+ self.context.next_funding_txid = Some(*txid);
4381
+ }
4382
+
4383
+ pub fn clear_next_funding_txid(&mut self) {
4384
+ self.context.next_funding_txid = None;
4385
+ }
4386
+
4373
4387
/// Unsets the existing funding information.
4374
4388
///
4375
4389
/// This must only be used if the channel has not yet completed funding and has not been used.
@@ -7397,10 +7411,7 @@ impl<SP: Deref> Channel<SP> where
7397
7411
next_remote_commitment_number: INITIAL_COMMITMENT_NUMBER - self.context.cur_counterparty_commitment_transaction_number - 1,
7398
7412
your_last_per_commitment_secret: remote_last_secret,
7399
7413
my_current_per_commitment_point: dummy_pubkey,
7400
- // TODO(dual_funding): If we've sent `commtiment_signed` for an interactive transaction
7401
- // construction but have not received `tx_signatures` we MUST set `next_funding_txid` to the
7402
- // txid of that interactive transaction, else we MUST NOT set it.
7403
- next_funding_txid: None,
7414
+ next_funding_txid: self.context.next_funding_txid,
7404
7415
}
7405
7416
}
7406
7417
@@ -9314,6 +9325,7 @@ impl<SP: Deref> Writeable for Channel<SP> where SP::Target: SignerProvider {
9314
9325
(45, cur_holder_commitment_point, option),
9315
9326
(47, next_holder_commitment_point, option),
9316
9327
(49, self.context.local_initiated_shutdown, option), // Added in 0.0.122
9328
+ (51, self.context.next_funding_txid, option), // Added in 0.0.124
9317
9329
});
9318
9330
9319
9331
Ok(())
@@ -9911,6 +9923,10 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
9911
9923
local_initiated_shutdown,
9912
9924
9913
9925
blocked_monitor_updates: blocked_monitor_updates.unwrap(),
9926
+ // If we've sent `commtiment_signed` for an interactive transaction construction,
9927
+ // but have not received `tx_signatures` we MUST set `next_funding_txid` to the
9928
+ // txid of that interactive transaction, else we MUST NOT set it.
9929
+ next_funding_txid: None,
9914
9930
},
9915
9931
dual_funding_channel_context: None,
9916
9932
interactive_tx_constructor: None,
0 commit comments