@@ -1450,6 +1450,10 @@ pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
1450
1450
/// If we can't release a [`ChannelMonitorUpdate`] until some external action completes, we
1451
1451
/// store it here and only release it to the `ChannelManager` once it asks for it.
1452
1452
blocked_monitor_updates: Vec<PendingChannelMonitorUpdate>,
1453
+ // If we've sent `commtiment_signed` for an interactive transaction construction,
1454
+ // but have not received `tx_signatures` we MUST set `next_funding_txid` to the
1455
+ // txid of that interactive transaction, else we MUST NOT set it.
1456
+ next_funding_txid: Option<Txid>,
1453
1457
}
1454
1458
1455
1459
#[cfg(any(dual_funding, splicing))]
@@ -2000,6 +2004,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2000
2004
local_initiated_shutdown: None,
2001
2005
2002
2006
blocked_monitor_updates: Vec::new(),
2007
+ next_funding_txid: None,
2003
2008
};
2004
2009
2005
2010
Ok(channel_context)
@@ -2223,6 +2228,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2223
2228
2224
2229
blocked_monitor_updates: Vec::new(),
2225
2230
local_initiated_shutdown: None,
2231
+ next_funding_txid: None,
2226
2232
})
2227
2233
}
2228
2234
@@ -4400,6 +4406,16 @@ impl<SP: Deref> Channel<SP> where
4400
4406
self.context.channel_state.clear_waiting_for_batch();
4401
4407
}
4402
4408
4409
+ #[cfg(any(dual_funding, splicing))]
4410
+ pub fn set_next_funding_txid(&mut self, txid: &Txid) {
4411
+ self.context.next_funding_txid = Some(*txid);
4412
+ }
4413
+
4414
+ #[cfg(any(dual_funding, splicing))]
4415
+ pub fn clear_next_funding_txid(&mut self) {
4416
+ self.context.next_funding_txid = None;
4417
+ }
4418
+
4403
4419
/// Unsets the existing funding information.
4404
4420
///
4405
4421
/// This must only be used if the channel has not yet completed funding and has not been used.
@@ -7440,10 +7456,7 @@ impl<SP: Deref> Channel<SP> where
7440
7456
next_remote_commitment_number: INITIAL_COMMITMENT_NUMBER - self.context.cur_counterparty_commitment_transaction_number - 1,
7441
7457
your_last_per_commitment_secret: remote_last_secret,
7442
7458
my_current_per_commitment_point: dummy_pubkey,
7443
- // TODO(dual_funding): If we've sent `commtiment_signed` for an interactive transaction
7444
- // construction but have not received `tx_signatures` we MUST set `next_funding_txid` to the
7445
- // txid of that interactive transaction, else we MUST NOT set it.
7446
- next_funding_txid: None,
7459
+ next_funding_txid: self.context.next_funding_txid,
7447
7460
}
7448
7461
}
7449
7462
@@ -9425,6 +9438,7 @@ impl<SP: Deref> Writeable for Channel<SP> where SP::Target: SignerProvider {
9425
9438
(45, cur_holder_commitment_point, option),
9426
9439
(47, next_holder_commitment_point, option),
9427
9440
(49, self.context.local_initiated_shutdown, option), // Added in 0.0.122
9441
+ (51, self.context.next_funding_txid, option), // Added in 0.0.124
9428
9442
});
9429
9443
9430
9444
Ok(())
@@ -10022,6 +10036,10 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
10022
10036
local_initiated_shutdown,
10023
10037
10024
10038
blocked_monitor_updates: blocked_monitor_updates.unwrap(),
10039
+ // If we've sent `commtiment_signed` for an interactive transaction construction,
10040
+ // but have not received `tx_signatures` we MUST set `next_funding_txid` to the
10041
+ // txid of that interactive transaction, else we MUST NOT set it.
10042
+ next_funding_txid: None,
10025
10043
},
10026
10044
#[cfg(any(dual_funding, splicing))]
10027
10045
dual_funding_channel_context: None,
0 commit comments