mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-01 17:01:09 +03:00
Default value for ChainType, when not in grin.toml
This commit is contained in:
parent
91fdaa8320
commit
97d7a43ccf
4 changed files with 12 additions and 7 deletions
|
@ -64,6 +64,12 @@ pub enum ChainTypes {
|
|||
Mainnet,
|
||||
}
|
||||
|
||||
impl Default for ChainTypes {
|
||||
fn default() -> ChainTypes {
|
||||
ChainTypes::UserTesting
|
||||
}
|
||||
}
|
||||
|
||||
lazy_static!{
|
||||
/// The mining parameter mode
|
||||
pub static ref CHAIN_TYPE: RwLock<ChainTypes> =
|
||||
|
|
|
@ -91,7 +91,7 @@ impl Server {
|
|||
|
||||
let mut genesis_block = None;
|
||||
if !chain::Chain::chain_exists(config.db_root.clone()) {
|
||||
let chain_type = config.chain_type.clone().unwrap();
|
||||
let chain_type = config.chain_type.clone();
|
||||
if chain_type == global::ChainTypes::Testnet1 {
|
||||
genesis_block = Some(genesis::genesis_testnet1());
|
||||
} else {
|
||||
|
|
|
@ -92,7 +92,8 @@ pub struct ServerConfig {
|
|||
pub api_http_addr: String,
|
||||
|
||||
/// Setup the server for tests, testnet or mainnet
|
||||
pub chain_type: Option<ChainTypes>,
|
||||
#[serde(default)]
|
||||
pub chain_type: ChainTypes,
|
||||
|
||||
/// Method used to get the list of seed nodes for initial bootstrap.
|
||||
pub seeding_type: Seeding,
|
||||
|
@ -125,7 +126,7 @@ impl Default for ServerConfig {
|
|||
seeds: None,
|
||||
p2p_config: Some(p2p::P2PConfig::default()),
|
||||
mining_config: Some(pow::types::MinerConfig::default()),
|
||||
chain_type: Some(ChainTypes::Testnet1),
|
||||
chain_type: ChainTypes::default(),
|
||||
pool_config: pool::PoolConfig::default(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,8 +57,7 @@ fn start_from_config_file(mut global_config: GlobalConfig) {
|
|||
.unwrap()
|
||||
.server
|
||||
.clone()
|
||||
.chain_type
|
||||
.unwrap(),
|
||||
.chain_type,
|
||||
);
|
||||
|
||||
grin::Server::start(global_config.members.as_mut().unwrap().server.clone()).unwrap();
|
||||
|
@ -102,8 +101,7 @@ fn main() {
|
|||
.unwrap()
|
||||
.server
|
||||
.clone()
|
||||
.chain_type
|
||||
.unwrap(),
|
||||
.chain_type,
|
||||
);
|
||||
} else {
|
||||
init_logger(Some(LoggingConfig::default()));
|
||||
|
|
Loading…
Reference in a new issue