Skip to content

Commit

Permalink
Merge #3293
Browse files Browse the repository at this point in the history
3293: Sort connected_nodes in `get_status` r=AurelienFT a=aoudiamoncef

* [ ] document all added functions
* [ ] try in sandbox /simulation/labnet
* [ ] unit tests on the added/changed features
  * [ ] make tests compile
  * [ ] make tests pass 
* [ ] add logs allowing easy debugging in case the changes caused problems
* [ ] if the API has changed, update the API specification

Co-authored-by: Moncef AOUDIA <ma@massa.net>
  • Loading branch information
bors[bot] and aoudiamoncef authored Dec 1, 2022
2 parents b78ba9d + ed74996 commit 006ad38
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions massa-api/src/public.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ impl MassaRpcServer for API<Public> {
connected_nodes: peers
.peers
.iter()
.sorted()
.flat_map(|(ip, peer)| {
peer.active_nodes
.iter()
Expand Down
2 changes: 1 addition & 1 deletion massa-bootstrap/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ impl BootstrapServer {
let mut server = BootstrapServerBinder::new(dplx, self.keypair.clone(), self.bootstrap_config.max_bytes_read_write, self.bootstrap_config.max_bootstrap_message_size, self.bootstrap_config.thread_count, self.bootstrap_config.max_datastore_key_length, self.bootstrap_config.randomness_size_bytes, self.bootstrap_config.consensus_bootstrap_part_size);
let _ = match tokio::time::timeout(self.bootstrap_config.write_error_timeout.into(), server.send(BootstrapServerMessage::BootstrapError {
error:
format!("Your last bootstrap on this server was {} ago and you have to wait before.", format_duration(per_ip_min_interval.saturating_sub(occ.get().elapsed())).to_string())
format!("Your last bootstrap on this server was {} ago and you have to wait before retrying.", format_duration(per_ip_min_interval.saturating_sub(occ.get().elapsed())))
})).await {
Err(_) => Err(std::io::Error::new(std::io::ErrorKind::TimedOut, "bootstrap error too early retry bootstrap send timed out").into()),
Ok(Err(e)) => Err(e),
Expand Down
4 changes: 2 additions & 2 deletions massa-network-exports/src/peers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use serde::{Deserialize, Serialize};
use std::ops::Bound::Included;
use std::{collections::HashMap, net::IpAddr};
/// Associate a peer info with nodes
#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
pub struct Peer {
/// peer info
pub peer_info: PeerInfo,
Expand Down Expand Up @@ -176,7 +176,7 @@ impl Default for PeerType {
}

/// All information concerning a peer is here
#[derive(Clone, Copy, Serialize, Deserialize, Debug)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, Debug)]
pub struct PeerInfo {
/// Peer ip address.
pub ip: IpAddr,
Expand Down

0 comments on commit 006ad38

Please sign in to comment.