diff --git a/config/src/comments.rs b/config/src/comments.rs index 2225dc2b1..000643621 100644 --- a/config/src/comments.rs +++ b/config/src/comments.rs @@ -21,14 +21,13 @@ fn comments() -> HashMap { retval.insert( "[server]".to_string(), " -# Sample Server Configuration File for Grin +# Generated Server Configuration File for Grin # # When running the grin executable without specifying any command line -# arguments, it will look for this file in three places, in the following +# arguments, it will look for this file in two places, in the following # order: # # -The working directory -# -The directory in which the executable resides # -[user home]/.grin # @@ -62,7 +61,7 @@ fn comments() -> HashMap { "chain_type".to_string(), " #The chain type, which defines the genesis block and the set of cuckoo -#parameters used for mining. Can be: +#parameters used for mining as well as wallet output coinbase maturity. Can be: #AutomatedTesting - For CI builds and instant blockchain creation #UserTesting - For regular user testing (cuckoo 16) #Testnet1 - Testnet1 genesis block (cuckoo 16) diff --git a/src/bin/cmd/wallet.rs b/src/bin/cmd/wallet.rs index 36aca992a..03f6f1461 100644 --- a/src/bin/cmd/wallet.rs +++ b/src/bin/cmd/wallet.rs @@ -22,7 +22,7 @@ use std::time::Duration; use clap::ArgMatches; use config::GlobalWalletConfig; -use core::core; +use core::{core, global}; use grin_wallet::{self, controller, display, libwallet}; use grin_wallet::{HTTPWalletClient, LMDBBackend, WalletConfig, WalletInst, WalletSeed}; use keychain; @@ -78,6 +78,10 @@ pub fn wallet_command(wallet_args: &ArgMatches, config: GlobalWalletConfig) { // just get defaults from the global config let mut wallet_config = config.members.unwrap().wallet; + if let Some(t) = wallet_config.chain_type.clone() { + global::set_mining_mode(t); + } + if wallet_args.is_present("external") { wallet_config.api_listen_interface = "0.0.0.0".to_string(); } diff --git a/wallet/src/types.rs b/wallet/src/types.rs index 38cbade35..cf1de1866 100644 --- a/wallet/src/types.rs +++ b/wallet/src/types.rs @@ -21,6 +21,7 @@ use std::path::MAIN_SEPARATOR; use blake2; use rand::{thread_rng, Rng}; +use core::global::ChainTypes; use error::{Error, ErrorKind}; use failure::ResultExt; use keychain::Keychain; @@ -31,10 +32,8 @@ pub const SEED_FILE: &'static str = "wallet.seed"; #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct WalletConfig { - // Right now the decision to run or not a wallet is based on the command. - // This may change in the near-future. - // pub enable_wallet: bool, - + // Chain parameters (default to Testnet3 if none at the moment) + pub chain_type: Option, // The api interface/ip_address that this api server (i.e. this wallet) will run // by default this is 127.0.0.1 (and will not accept connections from external clients) pub api_listen_interface: String, @@ -50,7 +49,7 @@ pub struct WalletConfig { impl Default for WalletConfig { fn default() -> WalletConfig { WalletConfig { - // enable_wallet: false, + chain_type: Some(ChainTypes::Testnet3), api_listen_interface: "127.0.0.1".to_string(), api_listen_port: 13415, check_node_api_http_addr: "http://127.0.0.1:13413".to_string(),