Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 25 additions & 11 deletions client/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -741,17 +741,22 @@ fn fill_config_keystore_password<C, G, E>(
}

/// 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,
G: RuntimeGenesis,
E: ChainSpecExtension,
pub fn fill_import_params<C, G, E>(
config: &mut Configuration<C, G, E>,
cli: &ImportParams,
role: service::Roles,
) -> error::Result<()>
where
C: Default,
G: RuntimeGenesis,
E: ChainSpecExtension,
{
config.database = DatabaseConfig::Path {
path: config.in_chain_config_dir(DEFAULT_DB_CONFIG_PATH).expect("We provided a base_path."),
cache_size: Some(cli.database_cache_size),
};
match config.database {
DatabaseConfig::Path { ref mut cache_size, .. } =>
*cache_size = Some(cli.database_cache_size),
DatabaseConfig::Custom(_) => {},
}

config.state_cache_size = cli.state_cache_size;

// by default we disable pruning if the node is an authority (i.e.
Expand Down Expand Up @@ -927,7 +932,16 @@ where
let spec = load_spec(cli, spec_factory)?;
let base_path = base_path(cli, version);

let config = service::Configuration::default_with_spec_and_base_path(spec.clone(), Some(base_path));
let mut config = service::Configuration::default_with_spec_and_base_path(
spec.clone(),
Some(base_path),
);

config.database = DatabaseConfig::Path {
path: config.in_chain_config_dir(DEFAULT_DB_CONFIG_PATH).expect("We provided a base_path."),
cache_size: None,
};

Ok(config)
}

Expand Down