@@ -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
@@ -4377,6 +4383,14 @@ impl<SP: Deref> Channel<SP> where
4377
4383
self.context.channel_state.clear_waiting_for_batch();
4378
4384
}
4379
4385
4386
+ pub fn set_next_funding_txid(&mut self, txid: &Txid) {
4387
+ self.context.next_funding_txid = Some(*txid);
4388
+ }
4389
+
4390
+ pub fn clear_next_funding_txid(&mut self) {
4391
+ self.context.next_funding_txid = None;
4392
+ }
4393
+
4380
4394
/// Unsets the existing funding information.
4381
4395
///
4382
4396
/// This must only be used if the channel has not yet completed funding and has not been used.
@@ -7404,10 +7418,7 @@ impl<SP: Deref> Channel<SP> where
7404
7418
next_remote_commitment_number: INITIAL_COMMITMENT_NUMBER - self.context.cur_counterparty_commitment_transaction_number - 1,
7405
7419
your_last_per_commitment_secret: remote_last_secret,
7406
7420
my_current_per_commitment_point: dummy_pubkey,
7407
- // TODO(dual_funding): If we've sent `commtiment_signed` for an interactive transaction
7408
- // construction but have not received `tx_signatures` we MUST set `next_funding_txid` to the
7409
- // txid of that interactive transaction, else we MUST NOT set it.
7410
- next_funding_txid: None,
7421
+ next_funding_txid: self.context.next_funding_txid,
7411
7422
}
7412
7423
}
7413
7424
@@ -9319,6 +9330,7 @@ impl<SP: Deref> Writeable for Channel<SP> where SP::Target: SignerProvider {
9319
9330
(45, cur_holder_commitment_point, option),
9320
9331
(47, next_holder_commitment_point, option),
9321
9332
(49, self.context.local_initiated_shutdown, option), // Added in 0.0.122
9333
+ (51, self.context.next_funding_txid, option), // Added in 0.0.124
9322
9334
});
9323
9335
9324
9336
Ok(())
@@ -9916,6 +9928,10 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
9916
9928
local_initiated_shutdown,
9917
9929
9918
9930
blocked_monitor_updates: blocked_monitor_updates.unwrap(),
9931
+ // If we've sent `commtiment_signed` for an interactive transaction construction,
9932
+ // but have not received `tx_signatures` we MUST set `next_funding_txid` to the
9933
+ // txid of that interactive transaction, else we MUST NOT set it.
9934
+ next_funding_txid: None,
9919
9935
},
9920
9936
dual_funding_channel_context: None,
9921
9937
interactive_tx_constructor: None,
0 commit comments