mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 23:57:56 +00:00
ChainSpec trait (#5185)
* ChainSpec trait * Apply suggestions from code review Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Added docs * Fixed build * Fixed build Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -20,7 +20,7 @@ use std::fs;
|
||||
use std::path::PathBuf;
|
||||
use structopt::StructOpt;
|
||||
use sc_service::{
|
||||
Configuration, ChainSpecExtension, RuntimeGenesis, ServiceBuilderCommand, ChainSpec, Roles,
|
||||
Configuration, ServiceBuilderCommand, ChainSpec, Roles,
|
||||
};
|
||||
use sp_runtime::traits::{Block as BlockT, Header as HeaderT};
|
||||
|
||||
@@ -59,15 +59,13 @@ impl<T: Read + Seek> ReadPlusSeek for T {}
|
||||
|
||||
impl ImportBlocksCmd {
|
||||
/// Run the import-blocks command
|
||||
pub fn run<G, E, B, BC, BB>(
|
||||
pub fn run<B, BC, BB>(
|
||||
self,
|
||||
config: Configuration<G, E>,
|
||||
config: Configuration,
|
||||
builder: B,
|
||||
) -> error::Result<()>
|
||||
where
|
||||
B: FnOnce(Configuration<G, E>) -> Result<BC, sc_service::error::Error>,
|
||||
G: RuntimeGenesis,
|
||||
E: ChainSpecExtension,
|
||||
B: FnOnce(Configuration) -> Result<BC, sc_service::error::Error>,
|
||||
BC: ServiceBuilderCommand<Block = BB> + Unpin,
|
||||
BB: sp_runtime::traits::Block + Debug,
|
||||
<<<BB as BlockT>::Header as HeaderT>::Number as std::str::FromStr>::Err: std::fmt::Debug,
|
||||
@@ -88,15 +86,13 @@ impl ImportBlocksCmd {
|
||||
}
|
||||
|
||||
/// Update and prepare a `Configuration` with command line parameters
|
||||
pub fn update_config<G, E, F>(
|
||||
pub fn update_config<F>(
|
||||
&self,
|
||||
mut config: &mut Configuration<G, E>,
|
||||
mut config: &mut Configuration,
|
||||
spec_factory: F,
|
||||
version: &VersionInfo,
|
||||
) -> error::Result<()> where
|
||||
G: RuntimeGenesis,
|
||||
E: ChainSpecExtension,
|
||||
F: FnOnce(&str) -> Result<Option<ChainSpec<G, E>>, String>,
|
||||
F: FnOnce(&str) -> Result<Box<dyn ChainSpec>, String>,
|
||||
{
|
||||
self.shared_params.update_config(&mut config, spec_factory, version)?;
|
||||
self.import_params.update_config(&mut config, Roles::FULL, self.shared_params.dev)?;
|
||||
|
||||
Reference in New Issue
Block a user