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