diff --git a/lightning-rapid-gossip-sync/src/processing.rs b/lightning-rapid-gossip-sync/src/processing.rs index c61187fcfff..708d54160eb 100644 --- a/lightning-rapid-gossip-sync/src/processing.rs +++ b/lightning-rapid-gossip-sync/src/processing.rs @@ -3,7 +3,6 @@ use core::ops::Deref; use core::sync::atomic::Ordering; use bitcoin::constants::ChainHash; -use bitcoin::secp256k1::PublicKey; use lightning::io; use lightning::ln::msgs::{ @@ -117,7 +116,7 @@ where }; let node_id_count: u32 = Readable::read(read_cursor)?; - let mut node_ids: Vec = Vec::with_capacity(core::cmp::min( + let mut node_ids: Vec = Vec::with_capacity(core::cmp::min( node_id_count, MAX_INITIAL_NODE_ID_VECTOR_CAPACITY, ) as usize); @@ -154,9 +153,8 @@ where let key_parity = node_detail_flag & 0b_0000_0011; pubkey_bytes[0] = key_parity; - let current_pubkey = PublicKey::from_slice(&pubkey_bytes)?; - let current_node_id = NodeId::from_pubkey(¤t_pubkey); - node_ids.push(current_pubkey); + let current_node_id = NodeId::from_slice(&pubkey_bytes)?; + node_ids.push(current_node_id); if is_reminder || has_address_details || feature_detail_marker > 0 { let mut synthetic_node_announcement = UnsignedNodeAnnouncement { diff --git a/lightning/src/routing/gossip.rs b/lightning/src/routing/gossip.rs index b9c4dc7dae3..b5a0d161c95 100644 --- a/lightning/src/routing/gossip.rs +++ b/lightning/src/routing/gossip.rs @@ -1993,7 +1993,7 @@ where /// All other parameters as used in [`msgs::UnsignedChannelAnnouncement`] fields. pub fn add_channel_from_partial_announcement( &self, short_channel_id: u64, timestamp: u64, features: ChannelFeatures, - node_id_1: PublicKey, node_id_2: PublicKey, + node_id_1: NodeId, node_id_2: NodeId, ) -> Result<(), LightningError> { if node_id_1 == node_id_2 { return Err(LightningError { @@ -2002,13 +2002,11 @@ where }); }; - let node_1 = NodeId::from_pubkey(&node_id_1); - let node_2 = NodeId::from_pubkey(&node_id_2); let channel_info = ChannelInfo { features, - node_one: node_1.clone(), + node_one: node_id_1, one_to_two: None, - node_two: node_2.clone(), + node_two: node_id_2, two_to_one: None, capacity_sats: None, announcement_message: None,