mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-20 19:11:08 +03:00
Add chaintype to wallet config (#1480)
* Add chain type to grin-wallet.toml * rustfmt
This commit is contained in:
parent
75f0ea6dd3
commit
974feaf07f
3 changed files with 12 additions and 10 deletions
|
@ -21,14 +21,13 @@ fn comments() -> HashMap<String, String> {
|
|||
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<String, String> {
|
|||
"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)
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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<ChainTypes>,
|
||||
// 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(),
|
||||
|
|
Loading…
Reference in a new issue