@@ -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();
@@ -11443,7 +11452,8 @@ impl<SP: Deref> Writeable for FundedChannel<SP> where SP::Target: SignerProvider
1144311452 (54, self.pending_funding, optional_vec), // Added in 0.2
1144411453 (55, removed_htlc_failure_attribution_data, optional_vec), // Added in 0.2
1144511454 (57, holding_cell_failure_attribution_data, optional_vec), // Added in 0.2
11446- (58, self.interactive_tx_signing_session, option) // Added in 0.2
11455+ (58, self.interactive_tx_signing_session, option), // Added in 0.2
11456+ (60, self.context.historical_scids, optional_vec), // Added in 0.2
1144711457 });
1144811458
1144911459 Ok(())
@@ -11759,6 +11769,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1175911769 let mut is_manual_broadcast = None;
1176011770
1176111771 let mut pending_funding = Some(Vec::new());
11772+ let mut historical_scids = Some(Vec::new());
1176211773
1176311774 let mut interactive_tx_signing_session: Option<InteractiveTxSigningSession> = None;
1176411775
@@ -11801,6 +11812,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1180111812 (55, removed_htlc_failure_attribution_data, optional_vec),
1180211813 (57, holding_cell_failure_attribution_data, optional_vec),
1180311814 (58, interactive_tx_signing_session, option), // Added in 0.2
11815+ (60, historical_scids, optional_vec), // Added in 0.2
1180411816 });
1180511817
1180611818 let holder_signer = signer_provider.derive_channel_signer(channel_keys_id);
@@ -12073,6 +12085,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1207312085 latest_inbound_scid_alias,
1207412086 // Later in the ChannelManager deserialization phase we scan for channels and assign scid aliases if its missing
1207512087 outbound_scid_alias,
12088+ historical_scids: historical_scids.unwrap(),
1207612089
1207712090 funding_tx_broadcast_safe_event_emitted: funding_tx_broadcast_safe_event_emitted.unwrap_or(false),
1207812091 channel_pending_event_emitted: channel_pending_event_emitted.unwrap_or(true),
0 commit comments