Add chain-info Subcommand (#11250)

* Add `blockchain-info` Subcommand

* Update comment

* Cleanup

* Cleanup

* Use `sync_run`

* Use `sc_client_db` utility fns instead service backend

* Use service `Backend` builder

* Impl `From<sp_blockchain::Info>`

* Rename to `chain-info`

* fmt

* Copyright year

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Expose `DatabaseParams`

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
tgmichel
2022-04-25 21:07:26 +02:00
committed by GitHub
parent 2541efdbcc
commit 5eb2e3292d
8 changed files with 121 additions and 1 deletions
+3
View File
@@ -94,4 +94,7 @@ pub enum Subcommand {
/// Revert the chain to a previous state.
Revert(sc_cli::RevertCmd),
/// Db meta columns information.
ChainInfo(sc_cli::ChainInfoCmd),
}
+4
View File
@@ -206,5 +206,9 @@ pub fn run() -> Result<()> {
Some(Subcommand::TryRuntime) => Err("TryRuntime wasn't enabled when building the node. \
You can enable it with `--features try-runtime`."
.into()),
Some(Subcommand::ChainInfo(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| cmd.run::<Block>(&config))
},
}
}