mirror of
https://github.com/jwinterm/mwixnet.git
synced 2026-10-17 14:21:25 +02:00
choose default ports by network
This commit is contained in:
@@ -240,6 +240,22 @@ pub fn wallet_owner_secret_path(chain_type: &ChainTypes) -> PathBuf {
|
||||
path
|
||||
}
|
||||
|
||||
pub fn grin_node_url(chain_type: &ChainTypes) -> SocketAddr {
|
||||
if *chain_type == ChainTypes::Testnet {
|
||||
"127.0.0.1:13413".parse().unwrap()
|
||||
} else {
|
||||
"127.0.0.1:3413".parse().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn wallet_owner_url(chain_type: &ChainTypes) -> SocketAddr {
|
||||
if *chain_type == ChainTypes::Testnet {
|
||||
"127.0.0.1:13420".parse().unwrap()
|
||||
} else {
|
||||
"127.0.0.1:3420".parse().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
+8
-2
@@ -70,14 +70,20 @@ fn real_main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
key: secp::random_secret(),
|
||||
interval_s: round_time.unwrap_or(DEFAULT_INTERVAL),
|
||||
addr: bind_addr.unwrap_or("0.0.0.0:3000").parse()?,
|
||||
grin_node_url: grin_node_url.unwrap_or("127.0.0.1:3413").parse()?,
|
||||
grin_node_url: match grin_node_url {
|
||||
Some(u) => u.parse()?,
|
||||
None => config::grin_node_url(&chain_type),
|
||||
},
|
||||
grin_node_secret_path: match grin_node_secret_path {
|
||||
Some(p) => Some(p.to_owned()),
|
||||
None => config::node_secret_path(&chain_type)
|
||||
.to_str()
|
||||
.map(|p| p.to_owned()),
|
||||
},
|
||||
wallet_owner_url: wallet_owner_url.unwrap_or("127.0.0.1:3420").parse()?,
|
||||
wallet_owner_url: match wallet_owner_url {
|
||||
Some(u) => u.parse()?,
|
||||
None => config::wallet_owner_url(&chain_type),
|
||||
},
|
||||
wallet_owner_secret_path: match wallet_owner_secret_path {
|
||||
Some(p) => Some(p.to_owned()),
|
||||
None => config::wallet_owner_secret_path(&chain_type)
|
||||
|
||||
Reference in New Issue
Block a user