Replace NodeIndex with PeerId everywhere (#2077)

* Replace NodeIndex with PeerId

* Fix tests

* More test fixing

* Whitespace
This commit is contained in:
Pierre Krieger
2019-03-23 10:34:28 +01:00
committed by Arkadiy Paronyan
parent 6fa40ec199
commit 6e394464b8
20 changed files with 424 additions and 480 deletions
+3 -5
View File
@@ -16,7 +16,7 @@
use super::*;
use network::{self, ProtocolStatus, NodeIndex, PeerId, PeerInfo as NetworkPeerInfo};
use network::{self, ProtocolStatus, PeerId, PeerInfo as NetworkPeerInfo};
use network::config::Roles;
use test_client::runtime::Block;
use assert_matches::assert_matches;
@@ -57,12 +57,11 @@ impl network::SyncProvider<Block> for Status {
}
}
fn peers(&self) -> Vec<(NodeIndex, NetworkPeerInfo<Block>)> {
fn peers(&self) -> Vec<(PeerId, NetworkPeerInfo<Block>)> {
let mut peers = vec![];
for _peer in 0..self.peers {
peers.push(
(1, NetworkPeerInfo {
peer_id: self.peer_id.clone(),
(self.peer_id.clone(), NetworkPeerInfo {
roles: Roles::FULL,
protocol_version: 1,
best_hash: Default::default(),
@@ -187,7 +186,6 @@ fn system_peers() {
is_dev: true,
}).system_peers().unwrap(),
vec![PeerInfo {
index: 1,
peer_id: peer_id.to_base58(),
roles: "FULL".into(),
protocol_version: 1,