mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 14:37:57 +00:00
Rename min-peers and max-peers CLI options (#909)
This commit is contained in:
@@ -82,15 +82,15 @@ args:
|
||||
help: Specify a list of reserved node addresses
|
||||
takes_value: true
|
||||
multiple: true
|
||||
- min-peers:
|
||||
long: min-peers
|
||||
value_name: MIN_PEERS
|
||||
help: Specify the minimum number of peers
|
||||
- out-peers:
|
||||
long: out-peers
|
||||
value_name: OUT_PEERS
|
||||
help: Specify the number of outgoing connections we're trying to maintain
|
||||
takes_value: true
|
||||
- max-peers:
|
||||
long: max-peers
|
||||
value_name: MAX_PEERS
|
||||
help: Specify the maximum number of peers
|
||||
- in-peers:
|
||||
long: in-peers
|
||||
value_name: IN_PEERS
|
||||
help: Specify the maximum number of incoming connections we're accepting
|
||||
takes_value: true
|
||||
- chain:
|
||||
long: chain
|
||||
|
||||
@@ -320,19 +320,17 @@ where
|
||||
None => None,
|
||||
};
|
||||
|
||||
let min_peers = match matches.value_of("min-peers") {
|
||||
Some(min_peers) => min_peers.parse().map_err(|_| "Invalid min-peers value specified.")?,
|
||||
let in_peers = match matches.value_of("in-peers") {
|
||||
Some(in_peers) => in_peers.parse().map_err(|_| "Invalid in-peers value specified.")?,
|
||||
None => 25,
|
||||
};
|
||||
let max_peers = match matches.value_of("max-peers") {
|
||||
Some(max_peers) => max_peers.parse().map_err(|_| "Invalid max-peers value specified.")?,
|
||||
None => 50,
|
||||
let out_peers = match matches.value_of("out-peers") {
|
||||
Some(out_peers) => out_peers.parse().map_err(|_| "Invalid out-peers value specified.")?,
|
||||
None => 25,
|
||||
};
|
||||
if min_peers > max_peers {
|
||||
return Err(error::ErrorKind::Input("Min-peers mustn't be larger than max-peers.".to_owned()).into());
|
||||
}
|
||||
config.network.min_peers = min_peers;
|
||||
config.network.max_peers = max_peers;
|
||||
|
||||
config.network.in_peers = in_peers;
|
||||
config.network.out_peers = out_peers;
|
||||
}
|
||||
|
||||
config.keys = matches.values_of("key").unwrap_or_default().map(str::to_owned).collect();
|
||||
|
||||
Reference in New Issue
Block a user