@@ -1562,6 +1562,10 @@ pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
1562
1562
/// If we can't release a [`ChannelMonitorUpdate`] until some external action completes, we
1563
1563
/// store it here and only release it to the `ChannelManager` once it asks for it.
1564
1564
blocked_monitor_updates: Vec<PendingChannelMonitorUpdate>,
1565
+ // If we've sent `commtiment_signed` for an interactive transaction construction,
1566
+ // but have not received `tx_signatures` we MUST set `next_funding_txid` to the
1567
+ // txid of that interactive transaction, else we MUST NOT set it.
1568
+ next_funding_txid: Option<Txid>,
1565
1569
}
1566
1570
1567
1571
#[cfg(any(dual_funding, splicing))]
@@ -2126,6 +2130,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2126
2130
local_initiated_shutdown: None,
2127
2131
2128
2132
blocked_monitor_updates: Vec::new(),
2133
+ next_funding_txid: None,
2129
2134
};
2130
2135
2131
2136
Ok(channel_context)
@@ -2346,6 +2351,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2346
2351
2347
2352
blocked_monitor_updates: Vec::new(),
2348
2353
local_initiated_shutdown: None,
2354
+ next_funding_txid: None,
2349
2355
})
2350
2356
}
2351
2357
@@ -4519,6 +4525,16 @@ impl<SP: Deref> Channel<SP> where
4519
4525
self.context.channel_state.clear_waiting_for_batch();
4520
4526
}
4521
4527
4528
+ #[cfg(any(dual_funding, splicing))]
4529
+ pub fn set_next_funding_txid(&mut self, txid: &Txid) {
4530
+ self.context.next_funding_txid = Some(*txid);
4531
+ }
4532
+
4533
+ #[cfg(any(dual_funding, splicing))]
4534
+ pub fn clear_next_funding_txid(&mut self) {
4535
+ self.context.next_funding_txid = None;
4536
+ }
4537
+
4522
4538
/// Unsets the existing funding information.
4523
4539
///
4524
4540
/// This must only be used if the channel has not yet completed funding and has not been used.
@@ -7505,10 +7521,7 @@ impl<SP: Deref> Channel<SP> where
7505
7521
next_remote_commitment_number: INITIAL_COMMITMENT_NUMBER - self.context.cur_counterparty_commitment_transaction_number - 1,
7506
7522
your_last_per_commitment_secret: remote_last_secret,
7507
7523
my_current_per_commitment_point: dummy_pubkey,
7508
- // TODO(dual_funding): If we've sent `commtiment_signed` for an interactive transaction
7509
- // construction but have not received `tx_signatures` we MUST set `next_funding_txid` to the
7510
- // txid of that interactive transaction, else we MUST NOT set it.
7511
- next_funding_txid: None,
7524
+ next_funding_txid: self.context.next_funding_txid,
7512
7525
}
7513
7526
}
7514
7527
@@ -9435,6 +9448,7 @@ impl<SP: Deref> Writeable for Channel<SP> where SP::Target: SignerProvider {
9435
9448
(43, malformed_htlcs, optional_vec), // Added in 0.0.119
9436
9449
// 45 and 47 are reserved for async signing
9437
9450
(49, self.context.local_initiated_shutdown, option), // Added in 0.0.122
9451
+ (51, self.context.next_funding_txid, option), // Added in 0.0.124
9438
9452
});
9439
9453
9440
9454
Ok(())
@@ -10010,6 +10024,10 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
10010
10024
local_initiated_shutdown,
10011
10025
10012
10026
blocked_monitor_updates: blocked_monitor_updates.unwrap(),
10027
+ // If we've sent `commtiment_signed` for an interactive transaction construction,
10028
+ // but have not received `tx_signatures` we MUST set `next_funding_txid` to the
10029
+ // txid of that interactive transaction, else we MUST NOT set it.
10030
+ next_funding_txid: None,
10013
10031
},
10014
10032
#[cfg(any(dual_funding, splicing))]
10015
10033
dual_funding_channel_context: None,
0 commit comments