@@ -958,8 +958,8 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, OM: Deref, L: Deref, CM
958
958
}
959
959
}
960
960
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.
963
963
///
964
964
/// For outbound connections, the [`PublicKey`] will be the same as the `their_node_id` parameter
965
965
/// 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
968
968
///
969
969
/// The returned `Option`s will only be `Some` if an address had been previously given via
970
970
/// [`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 ) > {
972
972
let peers = self . peers . read ( ) . unwrap ( ) ;
973
973
peers. values ( ) . filter_map ( |peer_mutex| {
974
974
let p = peer_mutex. lock ( ) . unwrap ( ) ;
975
975
if !p. handshake_complete ( ) {
976
976
return None ;
977
977
}
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 ( ) ) )
979
980
} ) . collect ( )
980
981
}
981
982
@@ -2746,6 +2747,8 @@ mod tests {
2746
2747
} ;
2747
2748
let addr_a = SocketAddress :: TcpIpV4 { addr : [ 127 , 0 , 0 , 1 ] , port : 1000 } ;
2748
2749
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) ;
2749
2752
let mut fd_b = FileDescriptor {
2750
2753
fd : 1 , outbound_data : Arc :: new ( Mutex :: new ( Vec :: new ( ) ) ) ,
2751
2754
disconnect : Arc :: new ( AtomicBool :: new ( false ) ) ,
@@ -2767,8 +2770,8 @@ mod tests {
2767
2770
let a_data = fd_a. outbound_data . lock ( ) . unwrap ( ) . split_off ( 0 ) ;
2768
2771
assert_eq ! ( peer_b. read_event( & mut fd_b, & a_data) . unwrap( ) , false ) ;
2769
2772
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 ) ) ) ;
2772
2775
2773
2776
( fd_a. clone ( ) , fd_b. clone ( ) )
2774
2777
}
0 commit comments