mirror of
https://github.com/romanz/electrs.git
synced 2024-11-19 01:43:29 +01:00
Add signet-magic to config
This commit is contained in:
parent
b94450c6a5
commit
ad864bf8af
@ -131,3 +131,8 @@ default = "concat!(\"Welcome to electrs \", env!(\"CARGO_PKG_VERSION\"), \" (Ele
|
||||
name = "log_filters"
|
||||
type = "String"
|
||||
doc = "Logging filters, overriding `RUST_LOG` environment variable (see https://docs.rs/env_logger/ for details)"
|
||||
|
||||
[[param]]
|
||||
name = "signet_magic"
|
||||
type = "u32"
|
||||
doc = "network magic for custom signet network (signet only)"
|
||||
|
@ -144,6 +144,7 @@ pub struct Config {
|
||||
pub sync_once: bool,
|
||||
pub disable_electrum_rpc: bool,
|
||||
pub server_banner: String,
|
||||
pub signet_magic: u32,
|
||||
pub args: Vec<String>,
|
||||
}
|
||||
|
||||
@ -231,6 +232,15 @@ impl Config {
|
||||
Network::Signet => 34224,
|
||||
};
|
||||
|
||||
let magic = match (config.network, config.signet_magic) {
|
||||
(Network::Signet, Some(magic)) => magic,
|
||||
(network, None) => network.magic(),
|
||||
(_, Some(_)) => {
|
||||
eprintln!("Error: signet magic only available on signet");
|
||||
std::process::exit(1);
|
||||
},
|
||||
};
|
||||
|
||||
let daemon_rpc_addr: SocketAddr = config.daemon_rpc_addr.map_or(
|
||||
(DEFAULT_SERVER_ADDRESS, default_daemon_rpc_port).into(),
|
||||
ResolvAddr::resolve_or_exit,
|
||||
@ -323,6 +333,7 @@ impl Config {
|
||||
sync_once: config.sync_once,
|
||||
disable_electrum_rpc: config.disable_electrum_rpc,
|
||||
server_banner: config.server_banner,
|
||||
signet_magic: magic,
|
||||
args: args.map(|a| a.into_string().unwrap()).collect(),
|
||||
};
|
||||
eprintln!(
|
||||
|
Loading…
Reference in New Issue
Block a user