Skip to content

Commit

Permalink
Fix revert command when running as parachain (#1363)
Browse files Browse the repository at this point in the history
  • Loading branch information
vedhavyas authored Sep 16, 2024
1 parent ae88fd4 commit 82b60ce
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 82b60ce

Please sign in to comment.