mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 03:27:58 +00:00
committed by
Bastian Köcher
parent
e8a655bbef
commit
0b52f194f5
@@ -56,7 +56,7 @@ use params::{
|
||||
NetworkConfigurationParams, MergeParameters, TransactionPoolParams,
|
||||
NodeKeyParams, NodeKeyType, Cors, CheckBlockCmd,
|
||||
};
|
||||
pub use params::{NoCustom, CoreParams, SharedParams, ExecutionStrategy as ExecutionStrategyParam};
|
||||
pub use params::{NoCustom, CoreParams, SharedParams, ImportParams, ExecutionStrategy};
|
||||
pub use traits::{GetLogFilter, AugmentClap};
|
||||
use app_dirs::{AppInfo, AppDataType};
|
||||
use log::info;
|
||||
@@ -440,7 +440,8 @@ impl<'a> ParseAndPrepareImport<'a> {
|
||||
E: ChainSpecExtension,
|
||||
Exit: IntoExit
|
||||
{
|
||||
let config = create_config_with_db_path(spec_factory, &self.params.shared_params, self.version)?;
|
||||
let mut config = create_config_with_db_path(spec_factory, &self.params.shared_params, self.version)?;
|
||||
fill_import_params(&mut config, &self.params.import_params, service::Roles::FULL)?;
|
||||
|
||||
let file: Box<dyn ReadPlusSeek + Send> = match self.params.input {
|
||||
Some(filename) => Box::new(File::open(filename)?),
|
||||
@@ -499,7 +500,8 @@ impl<'a> CheckBlock<'a> {
|
||||
E: ChainSpecExtension,
|
||||
Exit: IntoExit
|
||||
{
|
||||
let config = create_config_with_db_path(spec_factory, &self.params.shared_params, self.version)?;
|
||||
let mut config = create_config_with_db_path(spec_factory, &self.params.shared_params, self.version)?;
|
||||
fill_import_params(&mut config, &self.params.import_params, service::Roles::FULL)?;
|
||||
|
||||
let input = if self.params.input.starts_with("0x") { &self.params.input[2..] } else { &self.params.input[..] };
|
||||
let block_id = match FromStr::from_str(input) {
|
||||
@@ -738,7 +740,8 @@ fn fill_config_keystore_password<C, G, E>(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn fill_shared_config<C, G, E>(config: &mut Configuration<C, G, E>, cli: &SharedParams, role: service::Roles)
|
||||
/// Put block import CLI params into `config` object.
|
||||
pub fn fill_import_params<C, G, E>(config: &mut Configuration<C, G, E>, cli: &ImportParams, role: service::Roles)
|
||||
-> error::Result<()>
|
||||
where
|
||||
C: Default,
|
||||
@@ -776,7 +779,7 @@ where
|
||||
config.wasm_method = cli.wasm_method.into();
|
||||
|
||||
let exec = &cli.execution_strategies;
|
||||
let exec_all_or = |strat: params::ExecutionStrategy| exec.execution.unwrap_or(strat).into();
|
||||
let exec_all_or = |strat: ExecutionStrategy| exec.execution.unwrap_or(strat).into();
|
||||
config.execution_strategies = ExecutionStrategies {
|
||||
syncing: exec_all_or(exec.execution_syncing),
|
||||
importing: exec_all_or(exec.execution_import_block),
|
||||
@@ -813,7 +816,7 @@ where
|
||||
service::Roles::FULL
|
||||
};
|
||||
|
||||
fill_shared_config(&mut config, &cli.shared_params, role)?;
|
||||
fill_import_params(&mut config, &cli.import_params, role)?;
|
||||
|
||||
config.impl_name = impl_name;
|
||||
config.impl_commit = version.commit;
|
||||
@@ -924,8 +927,7 @@ where
|
||||
let spec = load_spec(cli, spec_factory)?;
|
||||
let base_path = base_path(cli, version);
|
||||
|
||||
let mut config = service::Configuration::default_with_spec_and_base_path(spec.clone(), Some(base_path));
|
||||
fill_shared_config(&mut config, &cli, service::Roles::FULL)?;
|
||||
let config = service::Configuration::default_with_spec_and_base_path(spec.clone(), Some(base_path));
|
||||
Ok(config)
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,11 @@ pub struct SharedParams {
|
||||
/// Sets a custom logging filter.
|
||||
#[structopt(short = "l", long = "log", value_name = "LOG_PATTERN")]
|
||||
pub log: Option<String>,
|
||||
}
|
||||
|
||||
/// Parameters for block import.
|
||||
#[derive(Debug, StructOpt, Clone)]
|
||||
pub struct ImportParams {
|
||||
/// Specify the state pruning mode, a number of blocks to keep or 'archive'.
|
||||
///
|
||||
/// Default is to keep all block states if the node is running as a
|
||||
@@ -505,6 +509,10 @@ pub struct RunCmd {
|
||||
#[structopt(flatten)]
|
||||
pub shared_params: SharedParams,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
#[structopt(flatten)]
|
||||
pub import_params: ImportParams,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
#[structopt(flatten)]
|
||||
pub network_config: NetworkConfigurationParams,
|
||||
@@ -764,6 +772,10 @@ pub struct ImportBlocksCmd {
|
||||
#[allow(missing_docs)]
|
||||
#[structopt(flatten)]
|
||||
pub shared_params: SharedParams,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
#[structopt(flatten)]
|
||||
pub import_params: ImportParams,
|
||||
}
|
||||
|
||||
impl_get_log_filter!(ImportBlocksCmd);
|
||||
@@ -784,6 +796,10 @@ pub struct CheckBlockCmd {
|
||||
#[allow(missing_docs)]
|
||||
#[structopt(flatten)]
|
||||
pub shared_params: SharedParams,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
#[structopt(flatten)]
|
||||
pub import_params: ImportParams,
|
||||
}
|
||||
|
||||
impl_get_log_filter!(CheckBlockCmd);
|
||||
|
||||
Reference in New Issue
Block a user