Network crate cleanups (#3049)

* Remove useless internal messages

* Remove NetworkService::disconnect_peer

* Remove NetworkMsg altogether

* Rename ProtocolMsg ServerToWorkerMsg

* Remove useless code

* Add example for parse_str_addr

* Move parse_str_addr and ProtocolId to config

* Don't reexport the content of config

* Rework the imports

* More reexports rework

* Add documentation

* Move finalization report to network future

* Move on_block_imported to worker

* get_value/put_value no longer locking

* local_peer_id() no longer locks

* Remove FetchFuture

* Service imports cleanup

* Produce the network state in the network task

* Merge network task and RPC network task

* Move network methods to NetworkWorker

* Remove Arc peers system from network

* add_reserved_peer now goes through the channel

* Remove Mutex around network swarm

* Remove the FnOnce alias traits

* Replace is_offline with num_connected

* Improve style of poll()

* Fix network tests

* Some doc in service module

* Remove macro export

* Minor doc changes

* Remove the synchronized() method of the import queue

* Line width

* Line widths

* Fix import queue tests

* Fix CLI tests
This commit is contained in:
Pierre Krieger
2019-07-08 15:33:29 +02:00
committed by Gavin Wood
parent 7df8e52cfe
commit 1e126eab2f
24 changed files with 598 additions and 814 deletions
+4 -4
View File
@@ -158,8 +158,8 @@ impl TestNetFactory for GrandpaTestNet {
}
}
fn peer(&self, i: usize) -> &GrandpaPeer {
&self.peers[i]
fn peer(&mut self, i: usize) -> &mut GrandpaPeer {
&mut self.peers[i]
}
fn peers(&self) -> &Vec<GrandpaPeer> {
@@ -949,7 +949,7 @@ fn allows_reimporting_change_blocks() {
let peers_b = &[AuthorityKeyring::Alice, AuthorityKeyring::Bob];
let voters = make_ids(peers_a);
let api = TestApi::new(voters);
let net = GrandpaTestNet::new(api.clone(), 3);
let mut net = GrandpaTestNet::new(api.clone(), 3);
let client = net.peer(0).client().clone();
let (block_import, ..) = net.make_block_import(client.clone());
@@ -998,7 +998,7 @@ fn test_bad_justification() {
let peers_b = &[AuthorityKeyring::Alice, AuthorityKeyring::Bob];
let voters = make_ids(peers_a);
let api = TestApi::new(voters);
let net = GrandpaTestNet::new(api.clone(), 3);
let mut net = GrandpaTestNet::new(api.clone(), 3);
let client = net.peer(0).client().clone();
let (block_import, ..) = net.make_block_import(client.clone());