@@ -2233,6 +2233,10 @@ pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
22332233 // blinded paths instead of simple scid+node_id aliases.
22342234 outbound_scid_alias: u64,
22352235
2236+ /// Short channel ids used by any prior FundingScope. These are maintained such that
2237+ /// ChannelManager can look up the channel for any pending HTLCs.
2238+ pub historical_scids: Vec<u64>,
2239+
22362240 // We track whether we already emitted a `ChannelPending` event.
22372241 channel_pending_event_emitted: bool,
22382242
@@ -3045,6 +3049,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
30453049
30463050 latest_inbound_scid_alias: None,
30473051 outbound_scid_alias: 0,
3052+ historical_scids: Vec::new(),
30483053
30493054 channel_pending_event_emitted: false,
30503055 funding_tx_broadcast_safe_event_emitted: false,
@@ -3281,6 +3286,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
32813286
32823287 latest_inbound_scid_alias: None,
32833288 outbound_scid_alias,
3289+ historical_scids: Vec::new(),
32843290
32853291 channel_pending_event_emitted: false,
32863292 funding_tx_broadcast_safe_event_emitted: false,
@@ -5299,6 +5305,9 @@ pub(super) struct FundedChannel<SP: Deref> where SP::Target: SignerProvider {
52995305#[cfg(splicing)]
53005306macro_rules! promote_splice_funding {
53015307 ($self: expr, $funding: expr) => {
5308+ if let Some(scid) = $self.funding.short_channel_id {
5309+ $self.context.historical_scids.push(scid);
5310+ }
53025311 core::mem::swap(&mut $self.funding, $funding);
53035312 $self.pending_splice = None;
53045313 $self.pending_funding.clear();
@@ -11272,6 +11281,7 @@ impl<SP: Deref> Writeable for FundedChannel<SP> where SP::Target: SignerProvider
1127211281 (54, self.pending_funding, optional_vec), // Added in 0.2
1127311282 (55, removed_htlc_failure_attribution_data, optional_vec), // Added in 0.2
1127411283 (57, holding_cell_failure_attribution_data, optional_vec), // Added in 0.2
11284+ (58, self.context.historical_scids, optional_vec), // Added in 0.2
1127511285 });
1127611286
1127711287 Ok(())
@@ -11587,6 +11597,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1158711597 let mut is_manual_broadcast = None;
1158811598
1158911599 let mut pending_funding = Some(Vec::new());
11600+ let mut historical_scids = Some(Vec::new());
1159011601
1159111602 read_tlv_fields!(reader, {
1159211603 (0, announcement_sigs, option),
@@ -11626,6 +11637,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1162611637 (54, pending_funding, optional_vec), // Added in 0.2
1162711638 (55, removed_htlc_failure_attribution_data, optional_vec),
1162811639 (57, holding_cell_failure_attribution_data, optional_vec),
11640+ (58, historical_scids, optional_vec), // Added in 0.2
1162911641 });
1163011642
1163111643 let holder_signer = signer_provider.derive_channel_signer(channel_keys_id);
@@ -11902,6 +11914,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1190211914 latest_inbound_scid_alias,
1190311915 // Later in the ChannelManager deserialization phase we scan for channels and assign scid aliases if its missing
1190411916 outbound_scid_alias,
11917+ historical_scids: historical_scids.unwrap(),
1190511918
1190611919 funding_tx_broadcast_safe_event_emitted: funding_tx_broadcast_safe_event_emitted.unwrap_or(false),
1190711920 channel_pending_event_emitted: channel_pending_event_emitted.unwrap_or(true),
0 commit comments