Add support for deserializing the new SCID alias in funding_locked
authorMatt Corallo <git@bluematt.me>
Fri, 4 Feb 2022 21:35:41 +0000 (21:35 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 9 Mar 2022 19:14:38 +0000 (19:14 +0000)
lightning/src/ln/channel.rs
lightning/src/ln/msgs.rs

index dd9fcbea9a8fa2bf05c21c9cf34c04b5e8698660..9935d3c019cbd3747394963186726b1e30fc3b40 100644 (file)
@@ -3457,6 +3457,7 @@ impl<Signer: Sign> Channel<Signer> {
                        Some(msgs::FundingLocked {
                                channel_id: self.channel_id(),
                                next_per_commitment_point,
+                               short_channel_id_alias: None,
                        })
                } else { None };
 
@@ -3678,6 +3679,7 @@ impl<Signer: Sign> Channel<Signer> {
                                funding_locked: Some(msgs::FundingLocked {
                                        channel_id: self.channel_id(),
                                        next_per_commitment_point,
+                                       short_channel_id_alias: None,
                                }),
                                raa: None, commitment_update: None, mon_update: None,
                                order: RAACommitmentOrder::CommitmentFirst,
@@ -3713,6 +3715,7 @@ impl<Signer: Sign> Channel<Signer> {
                        Some(msgs::FundingLocked {
                                channel_id: self.channel_id(),
                                next_per_commitment_point,
+                               short_channel_id_alias: None,
                        })
                } else { None };
 
@@ -4447,6 +4450,7 @@ impl<Signer: Sign> Channel<Signer> {
                                        return Some(msgs::FundingLocked {
                                                channel_id: self.channel_id,
                                                next_per_commitment_point,
+                                               short_channel_id_alias: None,
                                        });
                                }
                        } else {
index 7295c40d5442dd87639d08bbe6a6a3b2c1d5a873..fab396e3c7112af934021041abfcf2e1f4d609af 100644 (file)
@@ -241,6 +241,9 @@ pub struct FundingLocked {
        pub channel_id: [u8; 32],
        /// The per-commitment point of the second commitment transaction
        pub next_per_commitment_point: PublicKey,
+       /// If set, provides a short_channel_id alias for this channel. The sender will accept payments
+       /// to be forwarded over this SCID and forward them to this messages' recipient.
+       pub short_channel_id_alias: Option<u64>,
 }
 
 /// A shutdown message to be sent or received from a peer
@@ -1155,7 +1158,9 @@ impl_writeable_msg!(FundingSigned, {
 impl_writeable_msg!(FundingLocked, {
        channel_id,
        next_per_commitment_point,
-}, {});
+}, {
+       (1, short_channel_id_alias, option),
+});
 
 impl Writeable for Init {
        fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
@@ -2246,6 +2251,7 @@ mod tests {
                let funding_locked = msgs::FundingLocked {
                        channel_id: [2; 32],
                        next_per_commitment_point: pubkey_1,
+                       short_channel_id_alias: None,
                };
                let encoded_value = funding_locked.encode();
                let target_value = hex::decode("0202020202020202020202020202020202020202020202020202020202020202031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f").unwrap();