Generalize BlindedPath::introduction_node_id field
[rust-lightning] / lightning / src / blinded_path / message.rs
index 967ef612c318ad189ee93e0cb9c1b2dc63b8a529..1d2d624c8afb1acfdaffe9da8dd43f076b0d723f 100644 (file)
@@ -3,7 +3,7 @@ use bitcoin::secp256k1::{self, PublicKey, Secp256k1, SecretKey};
 #[allow(unused_imports)]
 use crate::prelude::*;
 
-use crate::blinded_path::{BlindedHop, BlindedPath};
+use crate::blinded_path::{BlindedHop, BlindedPath, IntroductionNode};
 use crate::blinded_path::utils;
 use crate::io;
 use crate::io::Cursor;
@@ -96,7 +96,7 @@ pub(crate) fn advance_path_by_one<NS: Deref, T: secp256k1::Signing + secp256k1::
                Ok(ChaChaPolyReadAdapter {
                        readable: ControlTlvs::Forward(ForwardTlvs { next_hop, next_blinding_override })
                }) => {
-                       let mut next_node_id = match next_hop {
+                       let next_node_id = match next_hop {
                                NextHop::NodeId(pubkey) => pubkey,
                                NextHop::ShortChannelId(_) => todo!(),
                        };
@@ -108,7 +108,7 @@ pub(crate) fn advance_path_by_one<NS: Deref, T: secp256k1::Signing + secp256k1::
                                }
                        };
                        mem::swap(&mut path.blinding_point, &mut new_blinding_point);
-                       mem::swap(&mut path.introduction_node_id, &mut next_node_id);
+                       path.introduction_node = IntroductionNode::NodeId(next_node_id);
                        Ok(())
                },
                _ => Err(())