@@ -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))]
@@ -1999,6 +2003,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
1999
2003
local_initiated_shutdown: None,
2000
2004
2001
2005
blocked_monitor_updates: Vec::new(),
2006
+ next_funding_txid: None,
2002
2007
};
2003
2008
2004
2009
Ok(channel_context)
@@ -2222,6 +2227,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2222
2227
2223
2228
blocked_monitor_updates: Vec::new(),
2224
2229
local_initiated_shutdown: None,
2230
+ next_funding_txid: None,
2225
2231
})
2226
2232
}
2227
2233
@@ -4393,6 +4399,16 @@ impl<SP: Deref> Channel<SP> where
4393
4399
self.context.channel_state.clear_waiting_for_batch();
4394
4400
}
4395
4401
4402
+ #[cfg(any(dual_funding, splicing))]
4403
+ pub fn set_next_funding_txid(&mut self, txid: &Txid) {
4404
+ self.context.next_funding_txid = Some(*txid);
4405
+ }
4406
+
4407
+ #[cfg(any(dual_funding, splicing))]
4408
+ pub fn clear_next_funding_txid(&mut self) {
4409
+ self.context.next_funding_txid = None;
4410
+ }
4411
+
4396
4412
/// Unsets the existing funding information.
4397
4413
///
4398
4414
/// This must only be used if the channel has not yet completed funding and has not been used.
@@ -7433,10 +7449,7 @@ impl<SP: Deref> Channel<SP> where
7433
7449
next_remote_commitment_number: INITIAL_COMMITMENT_NUMBER - self.context.cur_counterparty_commitment_transaction_number - 1,
7434
7450
your_last_per_commitment_secret: remote_last_secret,
7435
7451
my_current_per_commitment_point: dummy_pubkey,
7436
- // TODO(dual_funding): If we've sent `commtiment_signed` for an interactive transaction
7437
- // construction but have not received `tx_signatures` we MUST set `next_funding_txid` to the
7438
- // txid of that interactive transaction, else we MUST NOT set it.
7439
- next_funding_txid: None,
7452
+ next_funding_txid: self.context.next_funding_txid,
7440
7453
}
7441
7454
}
7442
7455
@@ -9415,6 +9428,7 @@ impl<SP: Deref> Writeable for Channel<SP> where SP::Target: SignerProvider {
9415
9428
(45, cur_holder_commitment_point, option),
9416
9429
(47, next_holder_commitment_point, option),
9417
9430
(49, self.context.local_initiated_shutdown, option), // Added in 0.0.122
9431
+ (51, self.context.next_funding_txid, option), // Added in 0.0.124
9418
9432
});
9419
9433
9420
9434
Ok(())
@@ -10012,6 +10026,10 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
10012
10026
local_initiated_shutdown,
10013
10027
10014
10028
blocked_monitor_updates: blocked_monitor_updates.unwrap(),
10029
+ // If we've sent `commtiment_signed` for an interactive transaction construction,
10030
+ // but have not received `tx_signatures` we MUST set `next_funding_txid` to the
10031
+ // txid of that interactive transaction, else we MUST NOT set it.
10032
+ next_funding_txid: None,
10015
10033
},
10016
10034
#[cfg(any(dual_funding, splicing))]
10017
10035
dual_funding_channel_context: None,
0 commit comments