Skip to content

Commit

Permalink
Print network graph statistics in nodeinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBlueMatt committed Oct 14, 2024
1 parent c6bf6ab commit bb9e642
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,9 @@ pub(crate) fn poll_for_user_input(

force_close_channel(channel_id, peer_pubkey, channel_manager.clone());
},
"nodeinfo" => node_info(&channel_manager, &chain_monitor, &peer_manager),
"nodeinfo" => {
node_info(&channel_manager, &chain_monitor, &peer_manager, &network_graph)
},
"listpeers" => list_peers(peer_manager.clone()),
"signmessage" => {
const MSG_STARTPOS: usize = "signmessage".len() + 1;
Expand Down Expand Up @@ -518,7 +520,7 @@ fn help() {

fn node_info(
channel_manager: &Arc<ChannelManager>, chain_monitor: &Arc<ChainMonitor>,
peer_manager: &Arc<PeerManager>,
peer_manager: &Arc<PeerManager>, network_graph: &Arc<NetworkGraph>,
) {
println!("\t{{");
println!("\t\t node_pubkey: {}", channel_manager.get_our_node_id());
Expand All @@ -537,6 +539,9 @@ fn node_info(
let close_fees_sats = balances.iter().map(close_fees_map).sum::<u64>();
println!("\t\t eventual_close_fees_sat: {}", close_fees_sats);
println!("\t\t num_peers: {}", peer_manager.list_peers().len());
let graph_lock = network_graph.read_only();
println!("\t\t network_nodes: {}", graph_lock.nodes().len());
println!("\t\t network_channels: {}", graph_lock.channels().len());
println!("\t}},");
}

Expand Down

0 comments on commit bb9e642

Please sign in to comment.