mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 02:21:14 +00:00
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:
committed by
Gavin Wood
parent
67bdfc7d8e
commit
fc7548ce27
@@ -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)
|
||||
|
||||
@@ -191,8 +191,8 @@ impl<B: BlockT> ChainSync<B> {
|
||||
_genesis_hash: info.chain.genesis_hash,
|
||||
peers: HashMap::new(),
|
||||
blocks: BlockCollection::new(),
|
||||
best_queued_hash: info.best_queued_hash.unwrap_or(info.chain.best_hash),
|
||||
best_queued_number: info.best_queued_number.unwrap_or(info.chain.best_number),
|
||||
best_queued_hash: info.chain.best_hash,
|
||||
best_queued_number: info.chain.best_number,
|
||||
extra_requests: ExtraRequestsAggregator::new(),
|
||||
role,
|
||||
required_block_attributes,
|
||||
@@ -852,8 +852,8 @@ impl<B: BlockT> ChainSync<B> {
|
||||
self.best_importing_number = Zero::zero();
|
||||
self.blocks.clear();
|
||||
let info = protocol.client().info();
|
||||
self.best_queued_hash = info.best_queued_hash.unwrap_or(info.chain.best_hash);
|
||||
self.best_queued_number = info.best_queued_number.unwrap_or(info.chain.best_number);
|
||||
self.best_queued_hash = info.chain.best_hash;
|
||||
self.best_queued_number = info.chain.best_number;
|
||||
debug!(target:"sync", "Restarted with {} ({})", self.best_queued_number, self.best_queued_hash);
|
||||
let ids: Vec<PeerId> = self.peers.drain().map(|(id, _)| id).collect();
|
||||
for id in ids {
|
||||
|
||||
Reference in New Issue
Block a user