@@ -286,7 +286,7 @@ pub(crate) fn poll_for_user_input(
286
286
) ;
287
287
} ,
288
288
"getoffer" => {
289
- let offer_builder = channel_manager. create_offer_builder ( String :: new ( ) ) ;
289
+ let offer_builder = channel_manager. create_offer_builder ( ) ;
290
290
if let Err ( e) = offer_builder {
291
291
println ! ( "ERROR: Failed to initiate offer building: {:?}" , e) ;
292
292
continue ;
@@ -603,14 +603,14 @@ fn node_info(channel_manager: &Arc<ChannelManager>, peer_manager: &Arc<PeerManag
603
603
println ! ( "\t \t num_usable_channels: {}" , chans. iter( ) . filter( |c| c. is_usable) . count( ) ) ;
604
604
let local_balance_msat = chans. iter ( ) . map ( |c| c. balance_msat ) . sum :: < u64 > ( ) ;
605
605
println ! ( "\t \t local_balance_msat: {}" , local_balance_msat) ;
606
- println ! ( "\t \t num_peers: {}" , peer_manager. get_peer_node_ids ( ) . len( ) ) ;
606
+ println ! ( "\t \t num_peers: {}" , peer_manager. list_peers ( ) . len( ) ) ;
607
607
println ! ( "\t }}," ) ;
608
608
}
609
609
610
610
fn list_peers ( peer_manager : Arc < PeerManager > ) {
611
611
println ! ( "\t {{" ) ;
612
- for ( pubkey , _ ) in peer_manager. get_peer_node_ids ( ) {
613
- println ! ( "\t \t pubkey: {}" , pubkey ) ;
612
+ for peer_details in peer_manager. list_peers ( ) {
613
+ println ! ( "\t \t pubkey: {}" , peer_details . counterparty_node_id ) ;
614
614
}
615
615
println ! ( "\t }}," ) ;
616
616
}
@@ -701,8 +701,8 @@ fn list_payments(
701
701
pub ( crate ) async fn connect_peer_if_necessary (
702
702
pubkey : PublicKey , peer_addr : SocketAddr , peer_manager : Arc < PeerManager > ,
703
703
) -> Result < ( ) , ( ) > {
704
- for ( node_pubkey , _ ) in peer_manager. get_peer_node_ids ( ) {
705
- if node_pubkey == pubkey {
704
+ for peer_details in peer_manager. list_peers ( ) {
705
+ if peer_details . counterparty_node_id == pubkey {
706
706
return Ok ( ( ) ) ;
707
707
}
708
708
}
@@ -725,7 +725,7 @@ pub(crate) async fn do_connect_peer(
725
725
_ = & mut connection_closed_future => return Err ( ( ) ) ,
726
726
_ = tokio:: time:: sleep( Duration :: from_millis( 10 ) ) => { } ,
727
727
} ;
728
- if peer_manager. get_peer_node_ids ( ) . iter ( ) . find ( | ( id , _ ) | * id == pubkey) . is_some ( ) {
728
+ if peer_manager. peer_by_node_id ( & pubkey) . is_some ( ) {
729
729
return Ok ( ( ) ) ;
730
730
}
731
731
}
@@ -747,8 +747,7 @@ fn do_disconnect_peer(
747
747
}
748
748
749
749
//check the pubkey matches a valid connected peer
750
- let peers = peer_manager. get_peer_node_ids ( ) ;
751
- if !peers. iter ( ) . any ( |( pk, _) | & pubkey == pk) {
750
+ if peer_manager. peer_by_node_id ( & pubkey) . is_none ( ) {
752
751
println ! ( "Error: Could not find peer {}" , pubkey) ;
753
752
return Err ( ( ) ) ;
754
753
}
0 commit comments