Make blocks per request configurable (#13824)

* Make blocks per request configurable

* Correct type

* Update docs

* Update client/cli/src/params/network_params.rs
This commit is contained in:
Aaro Altonen
2023-04-07 11:20:17 +03:00
committed by GitHub
parent 23de70a536
commit e77099c1a6
6 changed files with 81 additions and 33 deletions
@@ -264,6 +264,14 @@ where
SyncOperationMode::Warp => SyncMode::Warp,
};
let max_parallel_downloads = network_config.max_parallel_downloads;
let max_blocks_per_request = if network_config.max_blocks_per_request >
crate::MAX_BLOCKS_IN_RESPONSE as u32
{
log::info!(target: "sync", "clamping maximum blocks per request to {}", crate::MAX_BLOCKS_IN_RESPONSE);
crate::MAX_BLOCKS_IN_RESPONSE as u32
} else {
network_config.max_blocks_per_request
};
let cache_capacity = NonZeroUsize::new(
(network_config.default_peers_set.in_peers as usize +
network_config.default_peers_set.out_peers as usize)
@@ -318,6 +326,7 @@ where
roles,
block_announce_validator,
max_parallel_downloads,
max_blocks_per_request,
warp_sync_params,
metrics_registry,
network_service.clone(),