mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 08:11:04 +00:00
Remove blocking sync -> import-queue operations (#1818)
* remove blocking sync -> import-queue operations add specialization to testnet remove add peer default impl on TestNetFactory * remove empty brackets from dummy specialization * nits * make mut_peers take an fn once * add SpecializationFactory trait in test * remove add_peer imple in grandpa, fix typo * use cmp::max for best importing number comparison * remove import of non-existent create_peer * add sender to start message
This commit is contained in:
committed by
Bastian Köcher
parent
04fed82940
commit
8a72abffdd
@@ -71,6 +71,7 @@ pub trait TransactionPool<H: ExHashT, B: BlockT>: Send + Sync {
|
||||
}
|
||||
|
||||
/// A link implementation that connects to the network.
|
||||
#[derive(Clone)]
|
||||
pub struct NetworkLink<B: BlockT, S: NetworkSpecialization<B>> {
|
||||
/// The protocol sender
|
||||
pub(crate) protocol_sender: Sender<ProtocolMsg<B, S>>,
|
||||
@@ -83,6 +84,10 @@ impl<B: BlockT, S: NetworkSpecialization<B>> Link<B> for NetworkLink<B, S> {
|
||||
let _ = self.protocol_sender.send(ProtocolMsg::BlockImportedSync(hash.clone(), number));
|
||||
}
|
||||
|
||||
fn blocks_processed(&self, processed_blocks: Vec<B::Hash>, has_error: bool) {
|
||||
let _ = self.protocol_sender.send(ProtocolMsg::BlocksProcessed(processed_blocks, has_error));
|
||||
}
|
||||
|
||||
fn justification_imported(&self, who: NodeIndex, hash: &B::Hash, number: NumberFor<B>, success: bool) {
|
||||
let _ = self.protocol_sender.send(ProtocolMsg::JustificationImportResult(hash.clone(), number, success));
|
||||
if !success {
|
||||
@@ -95,10 +100,6 @@ impl<B: BlockT, S: NetworkSpecialization<B>> Link<B> for NetworkLink<B, S> {
|
||||
let _ = self.protocol_sender.send(ProtocolMsg::RequestJustification(hash.clone(), number));
|
||||
}
|
||||
|
||||
fn maintain_sync(&self) {
|
||||
let _ = self.protocol_sender.send(ProtocolMsg::MaintainSync);
|
||||
}
|
||||
|
||||
fn useless_peer(&self, who: NodeIndex, reason: &str) {
|
||||
trace!(target:"sync", "Useless peer {}, {}", who, reason);
|
||||
self.network_sender.send(NetworkMsg::ReportPeer(who, Severity::Useless(reason.to_string())));
|
||||
|
||||
Reference in New Issue
Block a user