]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Fix PeerManager::get_peer_node_ids to filter according to docs
authorMatt Corallo <git@bluematt.me>
Sat, 8 Sep 2018 17:57:20 +0000 (13:57 -0400)
committerMatt Corallo <git@bluematt.me>
Sat, 8 Sep 2018 17:59:39 +0000 (13:59 -0400)
src/ln/peer_handler.rs

index d7a7553ed1b9da5b6c3e739f6a6f8cc0198003e4..3d3588a4d8d9056bfa731f445bd77ef963ac98f8 100644 (file)
@@ -147,7 +147,12 @@ impl<Descriptor: SocketDescriptor> PeerManager<Descriptor> {
        /// 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.