@@ -728,19 +728,22 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, OM: Deref, L: Deref, CM
728
728
}
729
729
}
730
730
731
- /// Get the list of node ids for peers which have completed the initial handshake.
731
+ /// Get a list of tuples mapping from node id to network addresses for peers which have
732
+ /// completed the initial handshake.
732
733
///
733
- /// For outbound connections, this will be the same as the their_node_id parameter passed in to
734
- /// new_outbound_connection, however entries will only appear once the initial handshake has
735
- /// completed and we are sure the remote peer has the private key for the given node_id.
736
- pub fn get_peer_node_ids ( & self ) -> Vec < PublicKey > {
734
+ /// For outbound connections, the `PublicKey` will be the same as the `their_node_id` parameter
735
+ /// passed in to [`Self::new_outbound_connection`], however entries will only appear once the initial
736
+ /// handshake has completed and we are sure the remote peer has the private key for the given
737
+ /// `node_id`.
738
+ pub fn get_peer_node_ids ( & self ) -> Vec < ( PublicKey , Option < NetAddress > ) > {
737
739
let peers = self . peers . read ( ) . unwrap ( ) ;
738
740
peers. values ( ) . filter_map ( |peer_mutex| {
739
741
let p = peer_mutex. lock ( ) . unwrap ( ) ;
740
- if !p. channel_encryptor . is_ready_for_encryption ( ) || p. their_features . is_none ( ) {
742
+ if !p. channel_encryptor . is_ready_for_encryption ( ) || p. their_features . is_none ( ) ||
743
+ p. their_node_id . is_none ( ) {
741
744
return None ;
742
745
}
743
- p. their_node_id
746
+ Some ( ( p. their_node_id . unwrap ( ) , p . their_net_address . clone ( ) ) )
744
747
} ) . collect ( )
745
748
}
746
749
@@ -751,7 +754,7 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, OM: Deref, L: Deref, CM
751
754
SecretKey :: from_slice ( & Sha256 :: from_engine ( ephemeral_hash) . into_inner ( ) ) . expect ( "You broke SHA-256!" )
752
755
}
753
756
754
- /// Indicates a new outbound connection has been established to a node with the given node_id
757
+ /// Indicates a new outbound connection has been established to a node with the given ` node_id`
755
758
/// and an optional remote network address.
756
759
///
757
760
/// The remote network address adds the option to report a remote IP address back to a connecting
0 commit comments