Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Murzin <[email protected]>
  • Loading branch information
dima74 committed Oct 31, 2024
1 parent 5bc21bd commit 1194e61
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
10 changes: 5 additions & 5 deletions crates/iroha/tests/extra_functional/connected_peers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async fn register_new_peer() -> Result<()> {
)
.await;

let register = Register::peer(peer.id());
let register = Register::peer(peer.peer_id());
let client = network.client();
spawn_blocking(move || client.submit_blocking(register)).await??;

Expand All @@ -59,7 +59,7 @@ async fn connected_peers_with_f(faults: usize) -> Result<()> {

// Unregister a peer: committed with f = `faults` then `status.peers` decrements
let client = randomized_peers.choose(&mut thread_rng()).unwrap().client();
let unregister_peer = Unregister::peer(removed_peer.id());
let unregister_peer = Unregister::peer(removed_peer.peer_id());
spawn_blocking(move || client.submit_blocking(unregister_peer)).await??;
timeout(
network.sync_timeout(),
Expand All @@ -78,7 +78,7 @@ async fn connected_peers_with_f(faults: usize) -> Result<()> {
assert_eq!(status.peers, 0);

// Re-register the peer: committed with f = `faults` - 1 then `status.peers` increments
let register_peer = Register::peer(removed_peer.id());
let register_peer = Register::peer(removed_peer.peer_id());
let client = randomized_peers
.iter()
.choose(&mut thread_rng())
Expand Down Expand Up @@ -109,13 +109,13 @@ async fn assert_peers_status(
status.peers,
expected_peers,
"unexpected peers for {}",
peer.id()
peer.peer_id()
);
assert_eq!(
status.blocks,
expected_blocks,
"expected blocks for {}",
peer.id()
peer.peer_id()
);
})
.collect::<FuturesUnordered<_>>()
Expand Down
2 changes: 1 addition & 1 deletion crates/iroha/tests/extra_functional/unregister_peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async fn network_stable_after_add_and_after_remove_peer() -> Result<()> {
network.ensure_blocks(3).await?;
// and a new peer is registered
let new_peer = NetworkPeer::generate();
let new_peer_id = new_peer.id();
let new_peer_id = new_peer.peer_id();
let new_peer_client = new_peer.client();
network.add_peer(&new_peer);
new_peer.start(network.config(), None).await;
Expand Down
4 changes: 3 additions & 1 deletion crates/iroha_config/src/parameters/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,11 @@ pub struct SumeragiDebug {

#[derive(Debug, Clone, ReadConfig)]
pub struct Network {
/// Peer-to-peer address
/// Peer-to-peer address (internal, will be used only to bind to it).
#[config(env = "P2P_ADDRESS")]
pub address: WithOrigin<SocketAddr>,
/// Peer-to-peer address (external, as seen by other peers).
/// Will be gossiped to connected peers so that they can gossip it to other peers.
#[config(env = "P2P_PUBLIC_ADDRESS")]
pub public_address: WithOrigin<SocketAddr>,
#[config(default = "defaults::network::BLOCK_GOSSIP_SIZE")]
Expand Down
4 changes: 2 additions & 2 deletions crates/iroha_test_network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ impl NetworkBuilder {
pub fn build(self) -> Network {
let peers: Vec<_> = (0..self.n_peers).map(|_| NetworkPeer::generate()).collect();

let topology: UniqueVec<_> = peers.iter().map(|peer| peer.id()).collect();
let topology: UniqueVec<_> = peers.iter().map(|peer| peer.peer_id()).collect();

let block_sync_gossip_period = DEFAULT_BLOCK_SYNC;

Expand Down Expand Up @@ -782,7 +782,7 @@ impl NetworkPeer {
}

/// Generated [`PeerId`]
pub fn id(&self) -> PeerId {
pub fn peer_id(&self) -> PeerId {
self.id.id.clone()
}

Expand Down

0 comments on commit 1194e61

Please sign in to comment.