Use MAX associated const (#9196)

* Use MAX associated const
This commit is contained in:
Squirrel
2021-06-24 11:53:49 +01:00
committed by GitHub
parent 09d9c2c9f6
commit ea1f21a904
56 changed files with 178 additions and 178 deletions
+4 -4
View File
@@ -300,20 +300,20 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkWorker<B, H> {
let yamux_maximum_buffer_size = {
let requests_max = params.network_config
.request_response_protocols.iter()
.map(|cfg| usize::try_from(cfg.max_request_size).unwrap_or(usize::max_value()));
.map(|cfg| usize::try_from(cfg.max_request_size).unwrap_or(usize::MAX));
let responses_max = params.network_config
.request_response_protocols.iter()
.map(|cfg| usize::try_from(cfg.max_response_size).unwrap_or(usize::max_value()));
.map(|cfg| usize::try_from(cfg.max_response_size).unwrap_or(usize::MAX));
let notifs_max = params.network_config
.extra_sets.iter()
.map(|cfg| usize::try_from(cfg.max_notification_size).unwrap_or(usize::max_value()));
.map(|cfg| usize::try_from(cfg.max_notification_size).unwrap_or(usize::MAX));
// A "default" max is added to cover all the other protocols: ping, identify,
// kademlia, block announces, and transactions.
let default_max = cmp::max(
1024 * 1024,
usize::try_from(protocol::BLOCK_ANNOUNCES_TRANSACTIONS_SUBSTREAM_SIZE)
.unwrap_or(usize::max_value())
.unwrap_or(usize::MAX)
);
iter::once(default_max)