Skip to content

Commit

Permalink
fix panic on the libp2p port config
Browse files Browse the repository at this point in the history
  • Loading branch information
suemto committed Mar 18, 2021
1 parent 460c9db commit f2e26df
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl GlobalConfig {
global::ChainTypes::Floonet => {
defaults.api_http_addr = "127.0.0.1:13413".to_owned();
defaults.p2p_config.port = 13414;
defaults.libp2p_port = 13417;
defaults.libp2p_port = Some(13417);
defaults
.stratum_mining_config
.as_mut()
Expand All @@ -185,7 +185,7 @@ impl GlobalConfig {
}
global::ChainTypes::UserTesting => {
defaults.api_http_addr = "127.0.0.1:23413".to_owned();
defaults.libp2p_port = 23417;
defaults.libp2p_port = Some(23417);
defaults.p2p_config.port = 23414;
defaults.p2p_config.seeding_type = p2p::Seeding::None;
defaults
Expand Down
4 changes: 2 additions & 2 deletions servers/src/common/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ pub struct ServerConfig {
pub libp2p_enabled: Option<bool>,

/// libp2p connection port (will be activated with Tor)
pub libp2p_port: u16,
pub libp2p_port: Option<u16>,

/// Configuration for the peer-to-peer server
pub p2p_config: p2p::P2PConfig,
Expand Down Expand Up @@ -293,7 +293,7 @@ impl Default for ServerConfig {
run_test_miner: Some(false),
test_miner_wallet_url: None,
libp2p_enabled: Some(true),
libp2p_port: 3417,
libp2p_port: Some(3417),
webhook_config: WebHooksConfig::default(),
tor_config: TorConfig::default(),
}
Expand Down
4 changes: 2 additions & 2 deletions servers/src/grin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ impl Server {
cloned_config.p2p_config.host, cloned_config.p2p_config.port
),
&cloned_config.api_http_addr,
cloned_config.libp2p_port,
cloned_config.libp2p_port.unwrap_or(3417),
Some(&cloned_config.db_root),
cloned_config.tor_config.socks_port,
);
Expand Down Expand Up @@ -461,7 +461,7 @@ impl Server {
let libp2p_node_runner = libp2p_connection::run_libp2p_node(
tor_socks_port,
&secret,
libp2p_port,
libp2p_port.unwrap_or(3417),
fee_base,
output_validation_fn,
std::sync::Arc::new(std::sync::Mutex::new(1)), // passing new obj, because we never will stop the libp2p process
Expand Down

0 comments on commit f2e26df

Please sign in to comment.