Skip to content

Commit

Permalink
feat(dashboard): Show max num peers
Browse files Browse the repository at this point in the history
  • Loading branch information
aszepieniec committed Jan 8, 2025
1 parent e0c2318 commit f4a564a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/bin/dashboard_src/overview_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub struct OverviewData {

listen_address: Option<SocketAddr>,
peer_count: Option<usize>,
max_peer_count: Option<usize>,
max_num_peers: Option<usize>,
authenticated_peer_count: Option<usize>,

up_since: Option<u64>,
Expand Down Expand Up @@ -150,6 +150,7 @@ impl OverviewScreen {
own_overview_data.mempool_total_tx_count = Some(resp.mempool_total_tx_count.try_into().unwrap());
own_overview_data.mempool_own_tx_count = Some(resp.mempool_own_tx_count.try_into().unwrap());
own_overview_data.peer_count=resp.peer_count;
own_overview_data.max_num_peers = Some(resp.max_num_peers);
own_overview_data.authenticated_peer_count=Some(0);
own_overview_data.syncing=resp.syncing;
own_overview_data.available_balance = Some(resp.available_balance);
Expand Down Expand Up @@ -419,7 +420,7 @@ impl Widget for OverviewScreen {
lines.push(format!(
"number: {} / {}",
dashifnotset!(data.peer_count),
dashifnotset!(data.max_peer_count)
dashifnotset!(data.max_num_peers)
));
lines.push(format!(
"↪ authenticated: {}",
Expand Down
3 changes: 3 additions & 0 deletions src/rpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ pub struct DashBoardOverviewDataFromClient {

// `None` symbolizes failure in getting peer count
pub peer_count: Option<usize>,
pub max_num_peers: usize,

// `None` symbolizes failure to get mining status
pub mining_status: Option<MiningStatus>,
Expand Down Expand Up @@ -1174,6 +1175,7 @@ impl RPC for NeptuneRPCServer {
info!("proving capability: {proving_capability}");

let peer_count = Some(state.net.peer_map.len());
let max_num_peers = self.state.cli().max_num_peers as usize;

let mining_status = Some(state.mining_status.clone());

Expand Down Expand Up @@ -1202,6 +1204,7 @@ impl RPC for NeptuneRPCServer {
mempool_total_tx_count,
mempool_own_tx_count,
peer_count,
max_num_peers,
mining_status,
proving_capability,
confirmations,
Expand Down

0 comments on commit f4a564a

Please sign in to comment.