@@ -958,8 +958,8 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, OM: Deref, L: Deref, CM
958958 }
959959 }
960960
961- /// Get a list of tuples mapping from node id to network addresses for peers which have
962- /// completed the initial handshake.
961+ /// Get a list of tuples mapping from node id to network addresses and init features for peers
962+ /// which have completed the initial handshake.
963963 ///
964964 /// For outbound connections, the [`PublicKey`] will be the same as the `their_node_id` parameter
965965 /// passed in to [`Self::new_outbound_connection`], however entries will only appear once the initial
@@ -968,14 +968,15 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, OM: Deref, L: Deref, CM
968968 ///
969969 /// The returned `Option`s will only be `Some` if an address had been previously given via
970970 /// [`Self::new_outbound_connection`] or [`Self::new_inbound_connection`].
971- pub fn get_peer_node_ids ( & self ) -> Vec < ( PublicKey , Option < SocketAddress > ) > {
971+ pub fn get_peer_node_ids ( & self ) -> Vec < ( PublicKey , Option < SocketAddress > , InitFeatures ) > {
972972 let peers = self . peers . read ( ) . unwrap ( ) ;
973973 peers. values ( ) . filter_map ( |peer_mutex| {
974974 let p = peer_mutex. lock ( ) . unwrap ( ) ;
975975 if !p. handshake_complete ( ) {
976976 return None ;
977977 }
978- Some ( ( p. their_node_id . unwrap ( ) . 0 , p. their_socket_address . clone ( ) ) )
978+ Some ( ( p. their_node_id . unwrap ( ) . 0 , p. their_socket_address . clone ( ) ,
979+ p. their_features . clone ( ) . unwrap ( ) ) )
979980 } ) . collect ( )
980981 }
981982
@@ -2746,6 +2747,8 @@ mod tests {
27462747 } ;
27472748 let addr_a = SocketAddress :: TcpIpV4 { addr : [ 127 , 0 , 0 , 1 ] , port : 1000 } ;
27482749 let id_b = peer_b. node_signer . get_node_id ( Recipient :: Node ) . unwrap ( ) ;
2750+ let features_a = peer_a. init_features ( & id_b) ;
2751+ let features_b = peer_b. init_features ( & id_a) ;
27492752 let mut fd_b = FileDescriptor {
27502753 fd : 1 , outbound_data : Arc :: new ( Mutex :: new ( Vec :: new ( ) ) ) ,
27512754 disconnect : Arc :: new ( AtomicBool :: new ( false ) ) ,
@@ -2767,8 +2770,8 @@ mod tests {
27672770 let a_data = fd_a. outbound_data . lock ( ) . unwrap ( ) . split_off ( 0 ) ;
27682771 assert_eq ! ( peer_b. read_event( & mut fd_b, & a_data) . unwrap( ) , false ) ;
27692772
2770- assert ! ( peer_a. get_peer_node_ids( ) . contains( & ( id_b, Some ( addr_b) ) ) ) ;
2771- assert ! ( peer_b. get_peer_node_ids( ) . contains( & ( id_a, Some ( addr_a) ) ) ) ;
2773+ assert ! ( peer_a. get_peer_node_ids( ) . contains( & ( id_b, Some ( addr_b) , features_b ) ) ) ;
2774+ assert ! ( peer_b. get_peer_node_ids( ) . contains( & ( id_a, Some ( addr_a) , features_a ) ) ) ;
27722775
27732776 ( fd_a. clone ( ) , fd_b. clone ( ) )
27742777 }
0 commit comments