Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request paritytech#521 from subspace/extrac-force-use-pari…
Browse files Browse the repository at this point in the history
…ty-db

Extract a small helper function `force_use_parity_db`
  • Loading branch information
liuchengxu authored May 30, 2022
2 parents 2729d61 + 66c22fe commit 9db9b4e
Showing 1 changed file with 12 additions and 18 deletions.
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

0 comments on commit 9db9b4e

Please sign in to comment.