@@ -2267,6 +2267,10 @@ pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
22672267 // blinded paths instead of simple scid+node_id aliases.
22682268 outbound_scid_alias: u64,
22692269
2270+ /// Short channel ids used by any prior FundingScope. These are maintained such that
2271+ /// ChannelManager can look up the channel for any pending HTLCs.
2272+ pub historical_scids: Vec<u64>,
2273+
22702274 // We track whether we already emitted a `ChannelPending` event.
22712275 channel_pending_event_emitted: bool,
22722276
@@ -3083,6 +3087,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
30833087
30843088 latest_inbound_scid_alias: None,
30853089 outbound_scid_alias: 0,
3090+ historical_scids: Vec::new(),
30863091
30873092 channel_pending_event_emitted: false,
30883093 funding_tx_broadcast_safe_event_emitted: false,
@@ -3317,6 +3322,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
33173322
33183323 latest_inbound_scid_alias: None,
33193324 outbound_scid_alias,
3325+ historical_scids: Vec::new(),
33203326
33213327 channel_pending_event_emitted: false,
33223328 funding_tx_broadcast_safe_event_emitted: false,
@@ -5338,6 +5344,9 @@ pub(super) struct FundedChannel<SP: Deref> where SP::Target: SignerProvider {
53385344#[cfg(splicing)]
53395345macro_rules! promote_splice_funding {
53405346 ($self: expr, $funding: expr) => {
5347+ if let Some(scid) = $self.funding.short_channel_id {
5348+ $self.context.historical_scids.push(scid);
5349+ }
53415350 core::mem::swap(&mut $self.funding, $funding);
53425351 $self.pending_splice = None;
53435352 $self.pending_funding.clear();
@@ -11448,7 +11457,8 @@ impl<SP: Deref> Writeable for FundedChannel<SP> where SP::Target: SignerProvider
1144811457 (54, self.pending_funding, optional_vec), // Added in 0.2
1144911458 (55, removed_htlc_failure_attribution_data, optional_vec), // Added in 0.2
1145011459 (57, holding_cell_failure_attribution_data, optional_vec), // Added in 0.2
11451- (58, self.interactive_tx_signing_session, option) // Added in 0.2
11460+ (58, self.interactive_tx_signing_session, option), // Added in 0.2
11461+ (60, self.context.historical_scids, optional_vec), // Added in 0.2
1145211462 });
1145311463
1145411464 Ok(())
@@ -11764,6 +11774,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1176411774 let mut is_manual_broadcast = None;
1176511775
1176611776 let mut pending_funding = Some(Vec::new());
11777+ let mut historical_scids = Some(Vec::new());
1176711778
1176811779 let mut interactive_tx_signing_session: Option<InteractiveTxSigningSession> = None;
1176911780
@@ -11806,6 +11817,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1180611817 (55, removed_htlc_failure_attribution_data, optional_vec),
1180711818 (57, holding_cell_failure_attribution_data, optional_vec),
1180811819 (58, interactive_tx_signing_session, option), // Added in 0.2
11820+ (60, historical_scids, optional_vec), // Added in 0.2
1180911821 });
1181011822
1181111823 let holder_signer = signer_provider.derive_channel_signer(channel_keys_id);
@@ -12078,6 +12090,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1207812090 latest_inbound_scid_alias,
1207912091 // Later in the ChannelManager deserialization phase we scan for channels and assign scid aliases if its missing
1208012092 outbound_scid_alias,
12093+ historical_scids: historical_scids.unwrap(),
1208112094
1208212095 funding_tx_broadcast_safe_event_emitted: funding_tx_broadcast_safe_event_emitted.unwrap_or(false),
1208312096 channel_pending_event_emitted: channel_pending_event_emitted.unwrap_or(true),
0 commit comments