diff --git a/core/src/cluster_info.rs b/core/src/cluster_info.rs index 8dd2bbb5cd..2f470b5cbf 100644 --- a/core/src/cluster_info.rs +++ b/core/src/cluster_info.rs @@ -249,7 +249,7 @@ impl ClusterInfo { let nodes: Vec<_> = self .all_peers() .into_iter() - .map(|node| { + .map(|(node, last_updated)| { if !ContactInfo::is_valid_address(&node.gossip) { spy_nodes += 1; } @@ -266,7 +266,7 @@ impl ClusterInfo { tpu: {:20} | |\n \ rpc: {:20} | |\n", addr_to_string(&node.gossip), - now.saturating_sub(node.wallclock), + now.saturating_sub(last_updated), node.id, if node.id == my_id { "(me)" } else { "" }.to_string(), addr_to_string(&node.tpu), @@ -347,14 +347,17 @@ impl ClusterInfo { .collect() } - // All nodes in gossip, including spy nodes - pub(crate) fn all_peers(&self) -> Vec { + // All nodes in gossip (including spy nodes) and the last time we heard about them + pub(crate) fn all_peers(&self) -> Vec<(ContactInfo, u64)> { self.gossip .crds .table .values() - .filter_map(|x| x.value.contact_info()) - .cloned() + .filter_map(|x| { + x.value + .contact_info() + .map(|ci| (ci.clone(), x.local_timestamp)) + }) .collect() } diff --git a/core/src/rpc.rs b/core/src/rpc.rs index ccfe6f44fc..237cf817a3 100644 --- a/core/src/rpc.rs +++ b/core/src/rpc.rs @@ -294,7 +294,7 @@ impl RpcSol for RpcSolImpl { Ok(cluster_info .all_peers() .iter() - .filter_map(|contact_info| { + .filter_map(|(contact_info, _)| { if ContactInfo::is_valid_address(&contact_info.gossip) { Some(RpcContactInfo { id: contact_info.id.to_string(),