From 675faec05d5bae8757cb9991a8836801c7b4155e Mon Sep 17 00:00:00 2001 From: Quentin Le Sceller Date: Thu, 22 Mar 2018 12:49:27 -0400 Subject: [PATCH] Change wallet api_listen_port format (#815) * Change wallet api_listen_port format * Fix tests --- grin/tests/framework/mod.rs | 4 ++-- src/bin/grin.rs | 2 +- wallet/src/types.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/grin/tests/framework/mod.rs b/grin/tests/framework/mod.rs index 6034959c3..28f753298 100644 --- a/grin/tests/framework/mod.rs +++ b/grin/tests/framework/mod.rs @@ -162,7 +162,7 @@ impl LocalServerContainer { let working_dir = format!("target/tmp/test_servers/{}", config.name); let mut wallet_config = WalletConfig::default(); - wallet_config.api_listen_port = format!("{}", config.wallet_port); + wallet_config.api_listen_port = config.wallet_port; wallet_config.check_node_api_http_addr = config.wallet_validating_node_url.clone(); wallet_config.data_file_dir = working_dir.clone(); Ok(LocalServerContainer { @@ -263,7 +263,7 @@ impl LocalServerContainer { self.wallet_config = WalletConfig::default(); - self.wallet_config.api_listen_port = format!("{}", self.config.wallet_port); + self.wallet_config.api_listen_port = self.config.wallet_port; self.wallet_config.check_node_api_http_addr = self.config.wallet_validating_node_url.clone(); self.wallet_config.data_file_dir = self.working_dir.clone(); diff --git a/src/bin/grin.rs b/src/bin/grin.rs index 653758d4d..36390e832 100644 --- a/src/bin/grin.rs +++ b/src/bin/grin.rs @@ -516,7 +516,7 @@ fn wallet_command(wallet_args: &ArgMatches, global_config: GlobalConfig) { match wallet_args.subcommand() { ("listen", Some(listen_args)) => { if let Some(port) = listen_args.value_of("port") { - wallet_config.api_listen_port = port.to_string(); + wallet_config.api_listen_port = port.parse().unwrap(); } wallet::server::start_rest_apis(wallet_config, keychain); } diff --git a/wallet/src/types.rs b/wallet/src/types.rs index d690b203b..2c48a0e88 100644 --- a/wallet/src/types.rs +++ b/wallet/src/types.rs @@ -178,7 +178,7 @@ pub struct WalletConfig { // by default this is 127.0.0.1 (and will not accept connections from external clients) pub api_listen_interface: String, // The port this wallet will run on - pub api_listen_port: String, + pub api_listen_port: u16, // The api address of a running server node against which transaction inputs // will be checked during send pub check_node_api_http_addr: String, @@ -191,7 +191,7 @@ impl Default for WalletConfig { WalletConfig { // enable_wallet: false, api_listen_interface: "127.0.0.1".to_string(), - api_listen_port: "13415".to_string(), + api_listen_port: 13415, check_node_api_http_addr: "http://127.0.0.1:13413".to_string(), data_file_dir: ".".to_string(), }