Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract a small helper function force_use_parity_db #521

Merged
merged 1 commit into from
May 30, 2022
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
30 changes: 12 additions & 18 deletions crates/subspace-node/src/bin/subspace-node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use frame_benchmarking_cli::BenchmarkCmd;
use futures::future::TryFutureExt;
use futures::StreamExt;
use sc_cli::{ChainSpec, CliConfiguration, Database, SubstrateCli};
use sc_cli::{ChainSpec, CliConfiguration, Database, RunCmd, SubstrateCli};
use sc_service::PartialComponents;
use sp_core::crypto::Ss58AddressFormat;
use std::any::TypeId;
Expand Down Expand Up @@ -73,14 +73,18 @@ fn set_default_ss58_version<C: AsRef<dyn ChainSpec>>(chain_spec: C) {
}
}

fn main() -> Result<(), Error> {
let mut cli = Cli::from_args();

cli.run
.import_params
// TODO: Remove once paritydb is the default option, ref https://github.com/paritytech/substrate/pull/11537
fn force_use_parity_db(run: &mut RunCmd) {
run.import_params
.database_params
.database
.replace(Database::ParityDb);
}

fn main() -> Result<(), Error> {
let mut cli = Cli::from_args();

force_use_parity_db(&mut cli.run);

match &cli.subcommand {
Some(Subcommand::Key(cmd)) => cmd.run(&cli)?,
Expand Down Expand Up @@ -219,12 +223,7 @@ fn main() -> Result<(), Error> {
})?,
cli.secondary_chain_args.iter(),
);
secondary_chain_cli
.run
.import_params
.database_params
.database
.replace(Database::ParityDb);
force_use_parity_db(&mut secondary_chain_cli.run);

let secondary_chain_config = SubstrateCli::create_configuration(
&secondary_chain_cli,
Expand Down Expand Up @@ -370,12 +369,7 @@ fn main() -> Result<(), Error> {
})?,
cli.secondary_chain_args.iter(),
);
secondary_chain_cli
.run
.import_params
.database_params
.database
.replace(Database::ParityDb);
force_use_parity_db(&mut secondary_chain_cli.run);

let secondary_chain_config = SubstrateCli::create_configuration(
&secondary_chain_cli,
Expand Down