@@ -1963,6 +1963,7 @@ pub(super) struct FundingScope {
1963
1963
/// The hash of the block in which the funding transaction was included.
1964
1964
funding_tx_confirmed_in: Option<BlockHash>,
1965
1965
funding_tx_confirmation_height: u32,
1966
+ short_channel_id: Option<u64>,
1966
1967
}
1967
1968
1968
1969
impl Writeable for FundingScope {
@@ -1975,6 +1976,7 @@ impl Writeable for FundingScope {
1975
1976
(9, self.funding_transaction, option),
1976
1977
(11, self.funding_tx_confirmed_in, option),
1977
1978
(13, self.funding_tx_confirmation_height, required),
1979
+ (15, self.short_channel_id, option),
1978
1980
});
1979
1981
Ok(())
1980
1982
}
@@ -1990,6 +1992,7 @@ impl Readable for FundingScope {
1990
1992
let mut funding_transaction = None;
1991
1993
let mut funding_tx_confirmed_in = None;
1992
1994
let mut funding_tx_confirmation_height = RequiredWrapper(None);
1995
+ let mut short_channel_id = None;
1993
1996
1994
1997
read_tlv_fields!(reader, {
1995
1998
(1, value_to_self_msat, required),
@@ -1999,6 +2002,7 @@ impl Readable for FundingScope {
1999
2002
(9, funding_transaction, option),
2000
2003
(11, funding_tx_confirmed_in, option),
2001
2004
(13, funding_tx_confirmation_height, required),
2005
+ (15, short_channel_id, option),
2002
2006
});
2003
2007
2004
2008
Ok(Self {
@@ -2013,6 +2017,7 @@ impl Readable for FundingScope {
2013
2017
funding_transaction,
2014
2018
funding_tx_confirmed_in,
2015
2019
funding_tx_confirmation_height: funding_tx_confirmation_height.0.unwrap(),
2020
+ short_channel_id,
2016
2021
#[cfg(any(test, fuzzing))]
2017
2022
next_local_commitment_tx_fee_info_cached: Mutex::new(None),
2018
2023
#[cfg(any(test, fuzzing))]
@@ -2109,6 +2114,13 @@ impl FundingScope {
2109
2114
2110
2115
height.checked_sub(self.funding_tx_confirmation_height).map_or(0, |c| c + 1)
2111
2116
}
2117
+
2118
+ /// Gets the channel's `short_channel_id`.
2119
+ ///
2120
+ /// Will return `None` if the funding hasn't been confirmed yet.
2121
+ pub fn get_short_channel_id(&self) -> Option<u64> {
2122
+ self.short_channel_id
2123
+ }
2112
2124
}
2113
2125
2114
2126
/// Info about a pending splice, used in the pre-splice channel
@@ -2270,7 +2282,6 @@ where
2270
2282
/// milliseconds, so any accidental force-closes here should be exceedingly rare.
2271
2283
expecting_peer_commitment_signed: bool,
2272
2284
2273
- short_channel_id: Option<u64>,
2274
2285
/// Either the height at which this channel was created or the height at which it was last
2275
2286
/// serialized if it was serialized by versions prior to 0.0.103.
2276
2287
/// We use this to close if funding is never broadcasted.
@@ -3118,6 +3129,7 @@ where
3118
3129
funding_transaction: None,
3119
3130
funding_tx_confirmed_in: None,
3120
3131
funding_tx_confirmation_height: 0,
3132
+ short_channel_id: None,
3121
3133
};
3122
3134
let channel_context = ChannelContext {
3123
3135
user_id,
@@ -3181,7 +3193,6 @@ where
3181
3193
closing_fee_limits: None,
3182
3194
target_closing_feerate_sats_per_kw: None,
3183
3195
3184
- short_channel_id: None,
3185
3196
channel_creation_height: current_chain_height,
3186
3197
3187
3198
feerate_per_kw: open_channel_fields.commitment_feerate_sat_per_1000_weight,
@@ -3359,6 +3370,7 @@ where
3359
3370
funding_transaction: None,
3360
3371
funding_tx_confirmed_in: None,
3361
3372
funding_tx_confirmation_height: 0,
3373
+ short_channel_id: None,
3362
3374
};
3363
3375
let channel_context = Self {
3364
3376
user_id,
@@ -3420,7 +3432,6 @@ where
3420
3432
closing_fee_limits: None,
3421
3433
target_closing_feerate_sats_per_kw: None,
3422
3434
3423
- short_channel_id: None,
3424
3435
channel_creation_height: current_chain_height,
3425
3436
3426
3437
feerate_per_kw: commitment_feerate,
@@ -3644,13 +3655,6 @@ where
3644
3655
self.user_id
3645
3656
}
3646
3657
3647
- /// Gets the channel's `short_channel_id`.
3648
- ///
3649
- /// Will return `None` if the channel hasn't been confirmed yet.
3650
- pub fn get_short_channel_id(&self) -> Option<u64> {
3651
- self.short_channel_id
3652
- }
3653
-
3654
3658
/// Allowed in any state (including after shutdown)
3655
3659
pub fn latest_inbound_scid_alias(&self) -> Option<u64> {
3656
3660
self.latest_inbound_scid_alias
@@ -6192,7 +6196,7 @@ where
6192
6196
}
6193
6197
6194
6198
if let Some(scid_alias) = msg.short_channel_id_alias {
6195
- if Some(scid_alias) != self.context .short_channel_id {
6199
+ if Some(scid_alias) != self.funding .short_channel_id {
6196
6200
// The scid alias provided can be used to route payments *from* our counterparty,
6197
6201
// i.e. can be used for inbound payments and provided in invoices, but is not used
6198
6202
// when routing outbound payments.
@@ -8904,7 +8908,7 @@ where
8904
8908
8905
8909
self.funding.funding_tx_confirmation_height = height;
8906
8910
self.funding.funding_tx_confirmed_in = Some(*block_hash);
8907
- self.context .short_channel_id = match scid_from_parts(height as u64, index_in_block as u64, txo_idx as u64) {
8911
+ self.funding .short_channel_id = match scid_from_parts(height as u64, index_in_block as u64, txo_idx as u64) {
8908
8912
Ok(scid) => Some(scid),
8909
8913
Err(_) => panic!("Block was bogus - either height was > 16 million, had > 16 million transactions, or had > 65k outputs"),
8910
8914
}
@@ -9092,7 +9096,7 @@ where
9092
9096
return Err(ChannelError::Ignore("Cannot get a ChannelAnnouncement if the channel is not currently usable".to_owned()));
9093
9097
}
9094
9098
9095
- let short_channel_id = self.context .get_short_channel_id()
9099
+ let short_channel_id = self.funding .get_short_channel_id()
9096
9100
.ok_or(ChannelError::Ignore("Cannot get a ChannelAnnouncement if the channel has not been confirmed yet".to_owned()))?;
9097
9101
let node_id = NodeId::from_pubkey(&node_signer.get_node_id(Recipient::Node)
9098
9102
.map_err(|_| ChannelError::Ignore("Failed to retrieve own public key".to_owned()))?);
@@ -9165,7 +9169,7 @@ where
9165
9169
},
9166
9170
Ok(v) => v
9167
9171
};
9168
- let short_channel_id = match self.context .get_short_channel_id() {
9172
+ let short_channel_id = match self.funding .get_short_channel_id() {
9169
9173
Some(scid) => scid,
9170
9174
None => return None,
9171
9175
};
@@ -11512,7 +11516,7 @@ where
11512
11516
11513
11517
self.funding.funding_tx_confirmed_in.write(writer)?;
11514
11518
self.funding.funding_tx_confirmation_height.write(writer)?;
11515
- self.context .short_channel_id.write(writer)?;
11519
+ self.funding .short_channel_id.write(writer)?;
11516
11520
11517
11521
self.context.counterparty_dust_limit_satoshis.write(writer)?;
11518
11522
self.context.holder_dust_limit_satoshis.write(writer)?;
@@ -12171,6 +12175,7 @@ where
12171
12175
funding_transaction,
12172
12176
funding_tx_confirmed_in,
12173
12177
funding_tx_confirmation_height,
12178
+ short_channel_id,
12174
12179
},
12175
12180
pending_funding: pending_funding.unwrap(),
12176
12181
context: ChannelContext {
@@ -12234,7 +12239,6 @@ where
12234
12239
closing_fee_limits: None,
12235
12240
target_closing_feerate_sats_per_kw,
12236
12241
12237
- short_channel_id,
12238
12242
channel_creation_height,
12239
12243
12240
12244
counterparty_dust_limit_satoshis,
0 commit comments