/// completed and we are sure the remote peer has the private key for the given node_id.
pub fn get_peer_node_ids(&self) -> Vec<PublicKey> {
let peers = self.peers.lock().unwrap();
- peers.peers.values().filter_map(|p| p.their_node_id).collect()
+ peers.peers.values().filter_map(|p| {
+ if !p.channel_encryptor.is_ready_for_encryption() || p.their_global_features.is_none() {
+ return None;
+ }
+ p.their_node_id
+ }).collect()
}
/// Indicates a new outbound connection has been established to a node with the given node_id.
if msg.local_features.requires_unknown_bits() {
return Err(PeerHandleError{ no_connection_possible: true });
}
+ if peer.their_global_features.is_some() {
+ return Err(PeerHandleError{ no_connection_possible: false });
+ }
peer.their_global_features = Some(msg.global_features);
peer.their_local_features = Some(msg.local_features);