@@ -9767,6 +9767,13 @@ where
9767
9767
self.context.latest_inbound_scid_alias.or(self.funding.get_short_channel_id())
9768
9768
}
9769
9769
9770
+ /// Returns true if their channel_ready has been received
9771
+ #[cfg(splicing)]
9772
+ pub fn is_their_channel_ready(&self) -> bool {
9773
+ matches!(self.context.channel_state, ChannelState::AwaitingChannelReady(flags) if flags.is_set(AwaitingChannelReadyFlags::THEIR_CHANNEL_READY))
9774
+ || matches!(self.context.channel_state, ChannelState::ChannelReady(_))
9775
+ }
9776
+
9770
9777
/// Returns true if our channel_ready has been sent
9771
9778
pub fn is_our_channel_ready(&self) -> bool {
9772
9779
matches!(self.context.channel_state, ChannelState::AwaitingChannelReady(flags) if flags.is_set(AwaitingChannelReadyFlags::OUR_CHANNEL_READY))
@@ -10541,6 +10548,35 @@ where
10541
10548
}
10542
10549
}
10543
10550
10551
+ #[cfg(splicing)]
10552
+ fn maybe_get_your_last_funding_locked_txid(&self) -> Option<Txid> {
10553
+ self.pending_splice
10554
+ .as_ref()
10555
+ .and_then(|pending_splice| pending_splice.received_funding_txid)
10556
+ .or_else(|| {
10557
+ self.is_their_channel_ready().then(|| self.funding.get_funding_txid()).flatten()
10558
+ })
10559
+ }
10560
+ #[cfg(not(splicing))]
10561
+ fn maybe_get_your_last_funding_locked_txid(&self) -> Option<Txid> {
10562
+ None
10563
+ }
10564
+
10565
+ #[cfg(splicing)]
10566
+ fn maybe_get_my_current_funding_locked_txid(&self) -> Option<Txid> {
10567
+ self.pending_splice
10568
+ .as_ref()
10569
+ .and_then(|pending_splice| pending_splice.sent_funding_txid)
10570
+ .or_else(|| {
10571
+ self.is_our_channel_ready().then(|| self.funding.get_funding_txid()).flatten()
10572
+ })
10573
+ }
10574
+
10575
+ #[cfg(not(splicing))]
10576
+ fn maybe_get_my_current_funding_locked_txid(&self) -> Option<Txid> {
10577
+ None
10578
+ }
10579
+
10544
10580
/// May panic if called on a channel that wasn't immediately-previously
10545
10581
/// self.remove_uncommitted_htlcs_and_mark_paused()'d
10546
10582
#[rustfmt::skip]
@@ -10592,8 +10628,8 @@ where
10592
10628
your_last_per_commitment_secret: remote_last_secret,
10593
10629
my_current_per_commitment_point: dummy_pubkey,
10594
10630
next_funding_txid: self.maybe_get_next_funding_txid(),
10595
- your_last_funding_locked_txid: None ,
10596
- my_current_funding_locked_txid: None ,
10631
+ your_last_funding_locked_txid: self.maybe_get_your_last_funding_locked_txid() ,
10632
+ my_current_funding_locked_txid: self.maybe_get_my_current_funding_locked_txid() ,
10597
10633
}
10598
10634
}
10599
10635
0 commit comments