Allow empty magic

This commit is contained in:
Mononaut 2024-05-06 15:16:00 +00:00
parent c6b8be94b7
commit 181785b5c1
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E

View File

@ -141,6 +141,7 @@ impl Config {
.arg(
Arg::with_name("magic")
.long("magic")
.default_value("")
.takes_value(true),
)
.arg(
@ -336,6 +337,7 @@ impl Config {
let network_type = Network::from(network_name);
let magic: Option<u32> = m
.value_of("magic")
.filter(|s| !s.is_empty())
.map(|s| u32::from_str_radix(s, 16).expect("invalid network magic"));
let db_dir = Path::new(m.value_of("db_dir").unwrap_or("./db"));
let db_path = db_dir.join(network_name);