@@ -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 {
@@ -1983,6 +1987,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
1983
1987
local_initiated_shutdown: None,
1984
1988
1985
1989
blocked_monitor_updates: Vec::new(),
1990
+ next_funding_txid: None,
1986
1991
};
1987
1992
1988
1993
Ok(channel_context)
@@ -2206,6 +2211,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2206
2211
2207
2212
blocked_monitor_updates: Vec::new(),
2208
2213
local_initiated_shutdown: None,
2214
+ next_funding_txid: None,
2209
2215
})
2210
2216
}
2211
2217
@@ -4378,6 +4384,14 @@ impl<SP: Deref> Channel<SP> where
4378
4384
self.context.channel_state.clear_waiting_for_batch();
4379
4385
}
4380
4386
4387
+ pub fn set_next_funding_txid(&mut self, txid: &Txid) {
4388
+ self.context.next_funding_txid = Some(*txid);
4389
+ }
4390
+
4391
+ pub fn clear_next_funding_txid(&mut self) {
4392
+ self.context.next_funding_txid = None;
4393
+ }
4394
+
4381
4395
/// Unsets the existing funding information.
4382
4396
///
4383
4397
/// This must only be used if the channel has not yet completed funding and has not been used.
@@ -7405,10 +7419,7 @@ impl<SP: Deref> Channel<SP> where
7405
7419
next_remote_commitment_number: INITIAL_COMMITMENT_NUMBER - self.context.cur_counterparty_commitment_transaction_number - 1,
7406
7420
your_last_per_commitment_secret: remote_last_secret,
7407
7421
my_current_per_commitment_point: dummy_pubkey,
7408
- // TODO(dual_funding): If we've sent `commtiment_signed` for an interactive transaction
7409
- // construction but have not received `tx_signatures` we MUST set `next_funding_txid` to the
7410
- // txid of that interactive transaction, else we MUST NOT set it.
7411
- next_funding_txid: None,
7422
+ next_funding_txid: self.context.next_funding_txid,
7412
7423
}
7413
7424
}
7414
7425
@@ -9321,6 +9332,7 @@ impl<SP: Deref> Writeable for Channel<SP> where SP::Target: SignerProvider {
9321
9332
(45, cur_holder_commitment_point, option),
9322
9333
(47, next_holder_commitment_point, option),
9323
9334
(49, self.context.local_initiated_shutdown, option), // Added in 0.0.122
9335
+ (51, self.context.next_funding_txid, option), // Added in 0.0.124
9324
9336
});
9325
9337
9326
9338
Ok(())
@@ -9918,6 +9930,10 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
9918
9930
local_initiated_shutdown,
9919
9931
9920
9932
blocked_monitor_updates: blocked_monitor_updates.unwrap(),
9933
+ // If we've sent `commtiment_signed` for an interactive transaction construction,
9934
+ // but have not received `tx_signatures` we MUST set `next_funding_txid` to the
9935
+ // txid of that interactive transaction, else we MUST NOT set it.
9936
+ next_funding_txid: None,
9921
9937
},
9922
9938
dual_funding_channel_context: None,
9923
9939
interactive_tx_constructor: None,
0 commit comments