Light client integration tests (#2638)

* add light nodes to test_sync && test_consensus

* forbid light2light connections

* add light nodes to test_connectivity

* fixed light2light connection penalty

* post-merge fixes

* remove best_queued from Client info
This commit is contained in:
Svyatoslav Nikolsky
2019-06-05 18:14:42 +03:00
committed by Gavin Wood
parent 67bdfc7d8e
commit fc7548ce27
4 changed files with 138 additions and 48 deletions
+11 -2
View File
@@ -845,13 +845,22 @@ impl<B: BlockT, S: NetworkSpecialization<B>, H: ExHashT> Protocol<B, S, H> {
network_out.disconnect_peer(who);
return;
}
if self.config.roles.is_light() {
// we're not interested in light peers
if status.roles.is_light() {
debug!(target: "sync", "Peer {} is unable to serve light requests", who);
network_out.report_peer(who.clone(), i32::min_value());
network_out.disconnect_peer(who);
return;
}
// we don't interested in peers that are far behind us
let self_best_block = self
.context_data
.chain
.info()
.best_queued_number
.unwrap_or_else(|| Zero::zero());
.chain.best_number;
let blocks_difference = self_best_block
.checked_sub(&status.best_number)
.unwrap_or_else(Zero::zero)