peer_handler::get_peer_node_ids() get connected peers' node_id
router::get_addresses() to get network addresses by node_id
}
}
+ /// Get the list of known node ids
+ 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()
+ }
+
/// Indicates a new outbound connection has been established to a node with the given node_id.
/// Note that if an Err is returned here you MUST NOT call disconnect_event for the new
/// descriptor but must disconnect the connection immediately.
}
}
+ /// Get network addresses by node id
+ pub fn get_addresses(&self, pubkey: &PublicKey) -> Option<Vec<NetAddress>> {
+ let network = self.network_map.read().unwrap();
+ network.nodes.get(pubkey).map(|n| n.addresses.clone())
+ }
+
/// Marks a node as having failed a route. This will avoid re-using the node in routes for now,
/// with an expotnential decay in node "badness". Note that there is deliberately no
/// mark_channel_bad as a node may simply lie and suggest that an upstream channel from it is