@@ -2234,6 +2234,10 @@ pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
22342234 // blinded paths instead of simple scid+node_id aliases.
22352235 outbound_scid_alias: u64,
22362236
2237+ /// Short channel ids used by any prior FundingScope. These are maintained such that
2238+ /// ChannelManager can look up the channel for any pending HTLCs.
2239+ pub historical_scids: Vec<u64>,
2240+
22372241 // We track whether we already emitted a `ChannelPending` event.
22382242 channel_pending_event_emitted: bool,
22392243
@@ -3046,6 +3050,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
30463050
30473051 latest_inbound_scid_alias: None,
30483052 outbound_scid_alias: 0,
3053+ historical_scids: Vec::new(),
30493054
30503055 channel_pending_event_emitted: false,
30513056 funding_tx_broadcast_safe_event_emitted: false,
@@ -3282,6 +3287,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
32823287
32833288 latest_inbound_scid_alias: None,
32843289 outbound_scid_alias,
3290+ historical_scids: Vec::new(),
32853291
32863292 channel_pending_event_emitted: false,
32873293 funding_tx_broadcast_safe_event_emitted: false,
@@ -5302,6 +5308,9 @@ pub(super) struct FundedChannel<SP: Deref> where SP::Target: SignerProvider {
53025308#[cfg(splicing)]
53035309macro_rules! promote_splice_funding {
53045310 ($self: expr, $funding: expr) => {
5311+ if let Some(scid) = $self.funding.short_channel_id {
5312+ $self.context.historical_scids.push(scid);
5313+ }
53055314 core::mem::swap(&mut $self.funding, $funding);
53065315 $self.pending_splice = None;
53075316 $self.pending_funding.clear();
@@ -11265,6 +11274,7 @@ impl<SP: Deref> Writeable for FundedChannel<SP> where SP::Target: SignerProvider
1126511274 (54, self.pending_funding, optional_vec), // Added in 0.2
1126611275 (55, removed_htlc_failure_attribution_data, optional_vec), // Added in 0.2
1126711276 (57, holding_cell_failure_attribution_data, optional_vec), // Added in 0.2
11277+ (58, self.context.historical_scids, optional_vec), // Added in 0.2
1126811278 });
1126911279
1127011280 Ok(())
@@ -11580,6 +11590,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1158011590 let mut is_manual_broadcast = None;
1158111591
1158211592 let mut pending_funding = Some(Vec::new());
11593+ let mut historical_scids = Some(Vec::new());
1158311594
1158411595 read_tlv_fields!(reader, {
1158511596 (0, announcement_sigs, option),
@@ -11619,6 +11630,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1161911630 (54, pending_funding, optional_vec), // Added in 0.2
1162011631 (55, removed_htlc_failure_attribution_data, optional_vec),
1162111632 (57, holding_cell_failure_attribution_data, optional_vec),
11633+ (58, historical_scids, optional_vec), // Added in 0.2
1162211634 });
1162311635
1162411636 let holder_signer = signer_provider.derive_channel_signer(channel_keys_id);
@@ -11895,6 +11907,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1189511907 latest_inbound_scid_alias,
1189611908 // Later in the ChannelManager deserialization phase we scan for channels and assign scid aliases if its missing
1189711909 outbound_scid_alias,
11910+ historical_scids: historical_scids.unwrap(),
1189811911
1189911912 funding_tx_broadcast_safe_event_emitted: funding_tx_broadcast_safe_event_emitted.unwrap_or(false),
1190011913 channel_pending_event_emitted: channel_pending_event_emitted.unwrap_or(true),
0 commit comments