mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-23 16:41:06 +00:00
start import queue in chain_ops as well
This commit is contained in:
@@ -251,15 +251,15 @@ pub trait Link<B: BlockT>: Send {
|
|||||||
/// Get chain reference.
|
/// Get chain reference.
|
||||||
fn chain(&self) -> &Client<B>;
|
fn chain(&self) -> &Client<B>;
|
||||||
/// Block imported.
|
/// Block imported.
|
||||||
fn block_imported(&self, hash: &B::Hash, number: NumberFor<B>);
|
fn block_imported(&self, _hash: &B::Hash, _number: NumberFor<B>) { }
|
||||||
/// Maintain sync.
|
/// Maintain sync.
|
||||||
fn maintain_sync(&self);
|
fn maintain_sync(&self) { }
|
||||||
/// Disconnect from peer.
|
/// Disconnect from peer.
|
||||||
fn useless_peer(&self, who: NodeIndex, reason: &str);
|
fn useless_peer(&self, _who: NodeIndex, _reason: &str) { }
|
||||||
/// Disconnect from peer and restart sync.
|
/// Disconnect from peer and restart sync.
|
||||||
fn note_useless_and_restart_sync(&self, who: NodeIndex, reason: &str);
|
fn note_useless_and_restart_sync(&self, _who: NodeIndex, _reason: &str) { }
|
||||||
/// Restart sync.
|
/// Restart sync.
|
||||||
fn restart(&self);
|
fn restart(&self) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A link implementation that connects to the network.
|
/// A link implementation that connects to the network.
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ use serde_json;
|
|||||||
use client::BlockOrigin;
|
use client::BlockOrigin;
|
||||||
use runtime_primitives::generic::{SignedBlock, BlockId};
|
use runtime_primitives::generic::{SignedBlock, BlockId};
|
||||||
use runtime_primitives::traits::{As, Block, Header};
|
use runtime_primitives::traits::{As, Block, Header};
|
||||||
use network::import_queue::{ImportQueue, BlockData};
|
use network::import_queue::{ImportQueue, Link, BlockData};
|
||||||
use network::message;
|
use network::message;
|
||||||
use components::{self, Components, ServiceFactory, FactoryFullConfiguration, FactoryBlockNumber, RuntimeGenesis};
|
use components::{self, Components, ServiceFactory, FactoryFullConfiguration, FactoryBlockNumber, RuntimeGenesis};
|
||||||
use new_client;
|
use new_client;
|
||||||
@@ -87,8 +87,16 @@ pub fn export_blocks<F, E, W>(config: FactoryFullConfiguration<F>, exit: E, mut
|
|||||||
pub fn import_blocks<F, E, R>(config: FactoryFullConfiguration<F>, exit: E, mut input: R) -> error::Result<()>
|
pub fn import_blocks<F, E, R>(config: FactoryFullConfiguration<F>, exit: E, mut input: R) -> error::Result<()>
|
||||||
where F: ServiceFactory, E: Future<Item=(),Error=()> + Send + 'static, R: Read,
|
where F: ServiceFactory, E: Future<Item=(),Error=()> + Send + 'static, R: Read,
|
||||||
{
|
{
|
||||||
|
use network::ClientHandle;
|
||||||
|
|
||||||
|
struct DummyLink<T>(::std::sync::Arc<T>);
|
||||||
|
impl<B: Block, T: ClientHandle<B>> Link<B> for DummyLink<T> {
|
||||||
|
fn chain(&self) -> &ClientHandle<B> { &*self.0 }
|
||||||
|
}
|
||||||
|
|
||||||
let client = new_client::<F>(&config)?;
|
let client = new_client::<F>(&config)?;
|
||||||
let queue = components::FullComponents::<F>::build_import_queue(&config, client.clone())?;
|
let queue = components::FullComponents::<F>::build_import_queue(&config, client.clone())?;
|
||||||
|
queue.start(DummyLink(client.clone()))?;
|
||||||
|
|
||||||
let (exit_send, exit_recv) = std::sync::mpsc::channel();
|
let (exit_send, exit_recv) = std::sync::mpsc::channel();
|
||||||
::std::thread::spawn(move || {
|
::std::thread::spawn(move || {
|
||||||
|
|||||||
Reference in New Issue
Block a user