Skip to content

Commit 384ff45

Browse files
committed
Add support for deserializing the new SCID alias in funding_locked
1 parent a379469 commit 384ff45

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lightning/src/ln/channel.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3447,6 +3447,7 @@ impl<Signer: Sign> Channel<Signer> {
34473447
Some(msgs::FundingLocked {
34483448
channel_id: self.channel_id(),
34493449
next_per_commitment_point,
3450+
short_channel_id_alias: None,
34503451
})
34513452
} else { None };
34523453

@@ -3668,6 +3669,7 @@ impl<Signer: Sign> Channel<Signer> {
36683669
funding_locked: Some(msgs::FundingLocked {
36693670
channel_id: self.channel_id(),
36703671
next_per_commitment_point,
3672+
short_channel_id_alias: None,
36713673
}),
36723674
raa: None, commitment_update: None, mon_update: None,
36733675
order: RAACommitmentOrder::CommitmentFirst,
@@ -3703,6 +3705,7 @@ impl<Signer: Sign> Channel<Signer> {
37033705
Some(msgs::FundingLocked {
37043706
channel_id: self.channel_id(),
37053707
next_per_commitment_point,
3708+
short_channel_id_alias: None,
37063709
})
37073710
} else { None };
37083711

@@ -4437,6 +4440,7 @@ impl<Signer: Sign> Channel<Signer> {
44374440
return Some(msgs::FundingLocked {
44384441
channel_id: self.channel_id,
44394442
next_per_commitment_point,
4443+
short_channel_id_alias: None,
44404444
});
44414445
}
44424446
} else {

lightning/src/ln/msgs.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@ pub struct FundingLocked {
235235
pub channel_id: [u8; 32],
236236
/// The per-commitment point of the second commitment transaction
237237
pub next_per_commitment_point: PublicKey,
238+
/// If set, provides a short_channel_id alias for this channel. The sender will accept payments
239+
/// which are to be forwarded over this channel ID alias and forward them to us.
240+
pub short_channel_id_alias: Option<u64>,
238241
}
239242

240243
/// A shutdown message to be sent or received from a peer
@@ -1147,7 +1150,9 @@ impl_writeable_msg!(FundingSigned, {
11471150
impl_writeable_msg!(FundingLocked, {
11481151
channel_id,
11491152
next_per_commitment_point,
1150-
}, {});
1153+
}, {
1154+
(1, short_channel_id_alias, option),
1155+
});
11511156

11521157
impl Writeable for Init {
11531158
fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
@@ -2244,6 +2249,7 @@ mod tests {
22442249
let funding_locked = msgs::FundingLocked {
22452250
channel_id: [2; 32],
22462251
next_per_commitment_point: pubkey_1,
2252+
short_channel_id_alias: None,
22472253
};
22482254
let encoded_value = funding_locked.encode();
22492255
let target_value = hex::decode("0202020202020202020202020202020202020202020202020202020202020202031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f").unwrap();

0 commit comments

Comments
 (0)