mirror of
https://github.com/romanz/electrs.git
synced 2026-08-13 12:32:52 +02:00
Simplify network magic parsing
This commit is contained in:
parent
d846cc7565
commit
a80f0f7165
1 changed files with 4 additions and 4 deletions
|
|
@ -245,15 +245,15 @@ impl Config {
|
|||
unsupported => unsupported_network(unsupported),
|
||||
};
|
||||
|
||||
let magic = match (config.network, config.magic) {
|
||||
(_, Some(magic)) => magic.parse().unwrap_or_else(|error| {
|
||||
let magic = match config.magic {
|
||||
Some(magic_hex) => magic_hex.parse().unwrap_or_else(|error| {
|
||||
eprintln!(
|
||||
"Error: magic '{}' is not a valid hex string: {}",
|
||||
magic, error
|
||||
magic_hex, error
|
||||
);
|
||||
std::process::exit(1);
|
||||
}),
|
||||
(network, None) => network.magic(),
|
||||
None => config.network.magic(),
|
||||
};
|
||||
|
||||
let daemon_rpc_addr: SocketAddr = config.daemon_rpc_addr.map_or(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue