|
19 | 19 | use frame_benchmarking_cli::BenchmarkCmd; |
20 | 20 | use futures::future::TryFutureExt; |
21 | 21 | use futures::StreamExt; |
22 | | -use sc_cli::{ChainSpec, CliConfiguration, Database, SubstrateCli}; |
| 22 | +use sc_cli::{ChainSpec, CliConfiguration, Database, RunCmd, SubstrateCli}; |
23 | 23 | use sc_service::PartialComponents; |
24 | 24 | use sp_core::crypto::Ss58AddressFormat; |
25 | 25 | use std::any::TypeId; |
@@ -73,14 +73,18 @@ fn set_default_ss58_version<C: AsRef<dyn ChainSpec>>(chain_spec: C) { |
73 | 73 | } |
74 | 74 | } |
75 | 75 |
|
76 | | -fn main() -> Result<(), Error> { |
77 | | - let mut cli = Cli::from_args(); |
78 | | - |
79 | | - cli.run |
80 | | - .import_params |
| 76 | +// TODO: Remove once paritydb is the default option, ref https://github.com/paritytech/substrate/pull/11537 |
| 77 | +fn force_use_parity_db(run: &mut RunCmd) { |
| 78 | + run.import_params |
81 | 79 | .database_params |
82 | 80 | .database |
83 | 81 | .replace(Database::ParityDb); |
| 82 | +} |
| 83 | + |
| 84 | +fn main() -> Result<(), Error> { |
| 85 | + let mut cli = Cli::from_args(); |
| 86 | + |
| 87 | + force_use_parity_db(&mut cli.run); |
84 | 88 |
|
85 | 89 | match &cli.subcommand { |
86 | 90 | Some(Subcommand::Key(cmd)) => cmd.run(&cli)?, |
@@ -219,12 +223,7 @@ fn main() -> Result<(), Error> { |
219 | 223 | })?, |
220 | 224 | cli.secondary_chain_args.iter(), |
221 | 225 | ); |
222 | | - secondary_chain_cli |
223 | | - .run |
224 | | - .import_params |
225 | | - .database_params |
226 | | - .database |
227 | | - .replace(Database::ParityDb); |
| 226 | + force_use_parity_db(&mut secondary_chain_cli.run); |
228 | 227 |
|
229 | 228 | let secondary_chain_config = SubstrateCli::create_configuration( |
230 | 229 | &secondary_chain_cli, |
@@ -370,12 +369,7 @@ fn main() -> Result<(), Error> { |
370 | 369 | })?, |
371 | 370 | cli.secondary_chain_args.iter(), |
372 | 371 | ); |
373 | | - secondary_chain_cli |
374 | | - .run |
375 | | - .import_params |
376 | | - .database_params |
377 | | - .database |
378 | | - .replace(Database::ParityDb); |
| 372 | + force_use_parity_db(&mut secondary_chain_cli.run); |
379 | 373 |
|
380 | 374 | let secondary_chain_config = SubstrateCli::create_configuration( |
381 | 375 | &secondary_chain_cli, |
|
0 commit comments