From 30292fa14cbf5720bef14ff57329d23ebaa8b55c Mon Sep 17 00:00:00 2001
From: librelois <c@elo.tf>
Date: Tue, 25 Jan 2022 20:06:18 +0100
Subject: [PATCH] feat(cli): use paritydb

---
 node/src/command.rs | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/node/src/command.rs b/node/src/command.rs
index ba54b0320..d5a0a8b6b 100644
--- a/node/src/command.rs
+++ b/node/src/command.rs
@@ -145,7 +145,10 @@ impl SubstrateCli for Cli {
 
 /// Parse and run command line arguments
 pub fn run() -> sc_cli::Result<()> {
-    let cli = Cli::from_args();
+    let mut cli = Cli::from_args();
+
+    // Force some cli options
+    force_cli_options(&mut cli);
 
     match &cli.subcommand {
         Some(Subcommand::Key(cmd)) => cmd.run(&cli),
@@ -286,3 +289,24 @@ pub fn run() -> sc_cli::Result<()> {
         }
     }
 }
+
+fn force_cli_options(cli: &mut Cli) {
+    match cli.subcommand {
+        Some(Subcommand::CheckBlock(ref mut cmd)) => {
+            cmd.import_params.database_params.database = Some(sc_cli::Database::ParityDb);
+        }
+        Some(Subcommand::ExportBlocks(ref mut cmd)) => {
+            cmd.database_params.database = Some(sc_cli::Database::ParityDb);
+        }
+        Some(Subcommand::ImportBlocks(ref mut cmd)) => {
+            cmd.import_params.database_params.database = Some(sc_cli::Database::ParityDb);
+        }
+        Some(Subcommand::PurgeChain(ref mut cmd)) => {
+            cmd.database_params.database = Some(sc_cli::Database::ParityDb);
+        }
+        None => {
+            cli.run.import_params.database_params.database = Some(sc_cli::Database::ParityDb);
+        }
+        _ => {}
+    }
+}
-- 
GitLab