@@ -2234,6 +2234,10 @@ pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
2234
2234
// blinded paths instead of simple scid+node_id aliases.
2235
2235
outbound_scid_alias: u64,
2236
2236
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
+
2237
2241
// We track whether we already emitted a `ChannelPending` event.
2238
2242
channel_pending_event_emitted: bool,
2239
2243
@@ -3046,6 +3050,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3046
3050
3047
3051
latest_inbound_scid_alias: None,
3048
3052
outbound_scid_alias: 0,
3053
+ historical_scids: Vec::new(),
3049
3054
3050
3055
channel_pending_event_emitted: false,
3051
3056
funding_tx_broadcast_safe_event_emitted: false,
@@ -3282,6 +3287,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3282
3287
3283
3288
latest_inbound_scid_alias: None,
3284
3289
outbound_scid_alias,
3290
+ historical_scids: Vec::new(),
3285
3291
3286
3292
channel_pending_event_emitted: false,
3287
3293
funding_tx_broadcast_safe_event_emitted: false,
@@ -5302,6 +5308,9 @@ pub(super) struct FundedChannel<SP: Deref> where SP::Target: SignerProvider {
5302
5308
#[cfg(splicing)]
5303
5309
macro_rules! promote_splice_funding {
5304
5310
($self: expr, $funding: expr) => {
5311
+ if let Some(scid) = $self.funding.short_channel_id {
5312
+ $self.context.historical_scids.push(scid);
5313
+ }
5305
5314
core::mem::swap(&mut $self.funding, $funding);
5306
5315
$self.pending_splice = None;
5307
5316
$self.pending_funding.clear();
@@ -11265,6 +11274,7 @@ impl<SP: Deref> Writeable for FundedChannel<SP> where SP::Target: SignerProvider
11265
11274
(54, self.pending_funding, optional_vec), // Added in 0.2
11266
11275
(55, removed_htlc_failure_attribution_data, optional_vec), // Added in 0.2
11267
11276
(57, holding_cell_failure_attribution_data, optional_vec), // Added in 0.2
11277
+ (58, self.context.historical_scids, optional_vec), // Added in 0.2
11268
11278
});
11269
11279
11270
11280
Ok(())
@@ -11580,6 +11590,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
11580
11590
let mut is_manual_broadcast = None;
11581
11591
11582
11592
let mut pending_funding = Some(Vec::new());
11593
+ let mut historical_scids = Some(Vec::new());
11583
11594
11584
11595
read_tlv_fields!(reader, {
11585
11596
(0, announcement_sigs, option),
@@ -11619,6 +11630,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
11619
11630
(54, pending_funding, optional_vec), // Added in 0.2
11620
11631
(55, removed_htlc_failure_attribution_data, optional_vec),
11621
11632
(57, holding_cell_failure_attribution_data, optional_vec),
11633
+ (58, historical_scids, optional_vec), // Added in 0.2
11622
11634
});
11623
11635
11624
11636
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
11895
11907
latest_inbound_scid_alias,
11896
11908
// Later in the ChannelManager deserialization phase we scan for channels and assign scid aliases if its missing
11897
11909
outbound_scid_alias,
11910
+ historical_scids: historical_scids.unwrap(),
11898
11911
11899
11912
funding_tx_broadcast_safe_event_emitted: funding_tx_broadcast_safe_event_emitted.unwrap_or(false),
11900
11913
channel_pending_event_emitted: channel_pending_event_emitted.unwrap_or(true),
0 commit comments