Chain-selection subsystem data revert (#5350)

* Chain-selection subsystem data revert

* Cargo fmt

* Better code comments

* Remove unwraps

* Document public method

* Remove duplicated 'ChainSelectionSubsystem' impl block

* Fix typos

* Nitpicks

* Revert returns a service Error

* Removed superflous error handling

* Apply suggestions from code review

* Rename tree 'revert' to 'revert_to'

Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
This commit is contained in:
Davide Galassi
2022-04-28 17:44:14 +02:00
committed by GitHub
parent ac23b3f96c
commit bbdfc3d9c6
6 changed files with 243 additions and 45 deletions
+13 -1
View File
@@ -435,7 +435,19 @@ pub fn run() -> Result<()> {
Ok(runner.async_run(|mut config| {
let (client, backend, _, task_manager) = service::new_chain_ops(&mut config, None)?;
Ok((cmd.run(client, backend, None).map_err(Error::SubstrateCli), task_manager))
let aux_revert = Box::new(|client, backend, blocks| {
service::revert_backend(client, backend, blocks, config).map_err(|err| {
match err {
service::Error::Blockchain(err) => err.into(),
// Generic application-specific error.
err => sc_cli::Error::Application(err.into()),
}
})
});
Ok((
cmd.run(client, backend, Some(aux_revert)).map_err(Error::SubstrateCli),
task_manager,
))
})?)
},
Some(Subcommand::PvfPrepareWorker(cmd)) => {