thread local chain type vs global chain type (#3327)
* Introduce GLOBAL_CHAIN_TYPE and make CHAIN_TYPE thread_local. This makes testing more explicit and significantly more robust. * set_local_chain_type() in tests * cleanup - weird * get pool tests working with explicit local chain_type config * core tests working with explicit local chain_type * p2p tests working with explicit local chain_type * store tests working * cleanup, feedback
This commit is contained in:
+1
-12
@@ -23,7 +23,6 @@ use clap::ArgMatches;
|
||||
use ctrlc;
|
||||
|
||||
use crate::config::GlobalConfig;
|
||||
use crate::core::global;
|
||||
use crate::p2p::Seeding;
|
||||
use crate::servers;
|
||||
use crate::tui::ui;
|
||||
@@ -86,19 +85,9 @@ fn start_server_tui(config: servers::ServerConfig, logs_rx: Option<mpsc::Receive
|
||||
/// configuration.
|
||||
pub fn server_command(
|
||||
server_args: Option<&ArgMatches<'_>>,
|
||||
mut global_config: GlobalConfig,
|
||||
global_config: GlobalConfig,
|
||||
logs_rx: Option<mpsc::Receiver<LogEntry>>,
|
||||
) -> i32 {
|
||||
global::set_mining_mode(
|
||||
global_config
|
||||
.members
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.server
|
||||
.clone()
|
||||
.chain_type,
|
||||
);
|
||||
|
||||
// just get defaults from the global config
|
||||
let mut server_config = global_config.members.as_ref().unwrap().server.clone();
|
||||
|
||||
|
||||
+2
-1
@@ -140,7 +140,8 @@ fn real_main() -> i32 {
|
||||
};
|
||||
init_logger(Some(logging_config), logs_tx);
|
||||
|
||||
global::set_mining_mode(config.members.unwrap().server.chain_type);
|
||||
// One time initialization of the global chain_type.
|
||||
global::init_global_chain_type(config.members.unwrap().server.chain_type);
|
||||
|
||||
if let Some(file_path) = &config.config_file_path {
|
||||
info!(
|
||||
|
||||
Reference in New Issue
Block a user