@@ -1446,6 +1446,10 @@ pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
1446
1446
/// If we can't release a [`ChannelMonitorUpdate`] until some external action completes, we
1447
1447
/// store it here and only release it to the `ChannelManager` once it asks for it.
1448
1448
blocked_monitor_updates: Vec<PendingChannelMonitorUpdate>,
1449
+ // If we've sent `commtiment_signed` for an interactive transaction construction,
1450
+ // but have not received `tx_signatures` we MUST set `next_funding_txid` to the
1451
+ // txid of that interactive transaction, else we MUST NOT set it.
1452
+ next_funding_txid: Option<Txid>,
1449
1453
}
1450
1454
1451
1455
pub(super) trait InteractivelyFunded<SP: Deref> where SP::Target: SignerProvider {
@@ -1986,6 +1990,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
1986
1990
local_initiated_shutdown: None,
1987
1991
1988
1992
blocked_monitor_updates: Vec::new(),
1993
+ next_funding_txid: None,
1989
1994
};
1990
1995
1991
1996
Ok(channel_context)
@@ -2210,6 +2215,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2210
2215
2211
2216
blocked_monitor_updates: Vec::new(),
2212
2217
local_initiated_shutdown: None,
2218
+ next_funding_txid: None,
2213
2219
})
2214
2220
}
2215
2221
@@ -4391,6 +4397,14 @@ impl<SP: Deref> Channel<SP> where
4391
4397
self.context.channel_state.clear_waiting_for_batch();
4392
4398
}
4393
4399
4400
+ pub fn set_next_funding_txid(&mut self, txid: &Txid) {
4401
+ self.context.next_funding_txid = Some(*txid);
4402
+ }
4403
+
4404
+ pub fn clear_next_funding_txid(&mut self) {
4405
+ self.context.next_funding_txid = None;
4406
+ }
4407
+
4394
4408
/// Unsets the existing funding information.
4395
4409
///
4396
4410
/// This must only be used if the channel has not yet completed funding and has not been used.
@@ -7452,10 +7466,7 @@ impl<SP: Deref> Channel<SP> where
7452
7466
next_remote_commitment_number: INITIAL_COMMITMENT_NUMBER - self.context.cur_counterparty_commitment_transaction_number - 1,
7453
7467
your_last_per_commitment_secret: remote_last_secret,
7454
7468
my_current_per_commitment_point: dummy_pubkey,
7455
- // TODO(dual_funding): If we've sent `commtiment_signed` for an interactive transaction
7456
- // construction but have not received `tx_signatures` we MUST set `next_funding_txid` to the
7457
- // txid of that interactive transaction, else we MUST NOT set it.
7458
- next_funding_txid: None,
7469
+ next_funding_txid: self.context.next_funding_txid,
7459
7470
}
7460
7471
}
7461
7472
@@ -9384,6 +9395,7 @@ impl<SP: Deref> Writeable for Channel<SP> where SP::Target: SignerProvider {
9384
9395
(45, cur_holder_commitment_point, option),
9385
9396
(47, next_holder_commitment_point, option),
9386
9397
(49, self.context.local_initiated_shutdown, option), // Added in 0.0.122
9398
+ (51, self.context.next_funding_txid, option), // Added in 0.0.124
9387
9399
});
9388
9400
9389
9401
Ok(())
@@ -9982,6 +9994,10 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
9982
9994
local_initiated_shutdown,
9983
9995
9984
9996
blocked_monitor_updates: blocked_monitor_updates.unwrap(),
9997
+ // If we've sent `commtiment_signed` for an interactive transaction construction,
9998
+ // but have not received `tx_signatures` we MUST set `next_funding_txid` to the
9999
+ // txid of that interactive transaction, else we MUST NOT set it.
10000
+ next_funding_txid: None,
9985
10001
},
9986
10002
dual_funding_channel_context: None,
9987
10003
interactive_tx_constructor: None,
0 commit comments