Skip to content

Commit

Permalink
fix revert command when running as parachain
Browse files Browse the repository at this point in the history
  • Loading branch information
vedhavyas committed Sep 16, 2024
1 parent da7e689 commit f555979
Showing 1 changed file with 26 additions and 13 deletions.
39 changes: 26 additions & 13 deletions bin/collator/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,19 +261,32 @@ pub fn run() -> Result<()> {
}
Some(Subcommand::Revert(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.async_run(|config| {
let PartialComponents {
client,
task_manager,
backend,
..
} = parachain::new_partial(&config)?;
let aux_revert = Box::new(|client, _, blocks| {
sc_consensus_grandpa::revert(client, blocks)?;
Ok(())
});
Ok((cmd.run(client, backend, Some(aux_revert)), task_manager))
})
let chain_spec = &runner.config().chain_spec;
if chain_spec.is_dev() {
runner.async_run(|config| {
let PartialComponents {
client,
task_manager,
backend,
..
} = local::new_partial(&config)?;
let aux_revert = Box::new(|client, _, blocks| {
sc_consensus_grandpa::revert(client, blocks)?;
Ok(())
});
Ok((cmd.run(client, backend, Some(aux_revert)), task_manager))
})
} else {
runner.async_run(|config| {
let PartialComponents {
client,
task_manager,
backend,
..
} = parachain::new_partial(&config)?;
Ok((cmd.run(client, backend, None), task_manager))
})
}
}
Some(Subcommand::ExportGenesisState(cmd)) => {
let runner = cli.create_runner(cmd)?;
Expand Down

0 comments on commit f555979

Please sign in to comment.