Remove whisper (#10855)

This commit is contained in:
Artem Vorotnikov
2020-08-12 13:00:28 +03:00
parent 3f42b6178f
commit 54afb33333
31 changed files with 8 additions and 4520 deletions

View File

@@ -214,27 +214,6 @@ impl From<light_net::Status> for PipProtocolInfo {
}
}
/// Configuration to attach alternate protocol handlers.
/// Only works when IPC is disabled.
pub struct AttachedProtocol {
/// The protocol handler in question.
pub handler: Arc<dyn NetworkProtocolHandler + Send + Sync>,
/// 3-character ID for the protocol.
pub protocol_id: ProtocolId,
/// Supported versions and their packet counts.
pub versions: &'static [(u8, u8)],
}
impl AttachedProtocol {
fn register(&self, network: &NetworkService) {
let res = network.register_protocol(self.handler.clone(), self.protocol_id, self.versions);
if let Err(e) = res {
warn!(target: "sync", "Error attaching protocol {:?}: {:?}", self.protocol_id, e);
}
}
}
/// A prioritized tasks run in a specialised timer.
/// Every task should be completed within a hard deadline,
/// if it's not it's either cancelled or split into multiple tasks.
@@ -282,8 +261,6 @@ pub struct Params {
pub provider: Arc<dyn crate::light::Provider>,
/// Network layer configuration.
pub network_config: NetworkConfiguration,
/// Other protocols to attach.
pub attached_protos: Vec<AttachedProtocol>,
}
/// Ethereum network protocol handler
@@ -294,8 +271,6 @@ pub struct EthSync {
eth_handler: Arc<SyncProtocolHandler>,
/// Light (pip) protocol handler
light_proto: Option<Arc<LightProtocol>>,
/// Other protocols to attach.
attached_protos: Vec<AttachedProtocol>,
/// The main subprotocol name
subprotocol_name: [u8; 3],
/// Light subprotocol name.
@@ -387,7 +362,6 @@ impl EthSync {
light_proto: light_proto,
subprotocol_name: params.config.subprotocol_name,
light_subprotocol_name: params.config.light_subprotocol_name,
attached_protos: params.attached_protos,
priority_tasks: Mutex::new(priority_tasks_tx),
});
@@ -643,11 +617,6 @@ impl ChainNotify for EthSync {
)
.unwrap_or_else(|e| warn!("Error registering light client protocol: {:?}", e));
}
// register any attached protocols.
for proto in &self.attached_protos {
proto.register(&self.network)
}
}
fn stop(&self) {
@@ -979,15 +948,12 @@ pub struct LightSyncParams<L> {
pub subprotocol_name: [u8; 3],
/// Other handlers to attach.
pub handlers: Vec<Arc<dyn LightHandler>>,
/// Other subprotocols to run.
pub attached_protos: Vec<AttachedProtocol>,
}
/// Service for light synchronization.
pub struct LightSync {
proto: Arc<LightProtocol>,
sync: Arc<dyn SyncInfo + Sync + Send>,
attached_protos: Vec<AttachedProtocol>,
network: NetworkService,
subprotocol_name: [u8; 3],
network_id: u64,
@@ -1031,7 +997,6 @@ impl LightSync {
Ok(LightSync {
proto: light_proto,
sync: sync,
attached_protos: params.attached_protos,
network: service,
subprotocol_name: params.subprotocol_name,
network_id: params.network_id,
@@ -1104,10 +1069,6 @@ impl ManageNetwork for LightSync {
::light::net::PROTOCOL_VERSIONS,
)
.unwrap_or_else(|e| warn!("Error registering light client protocol: {:?}", e));
for proto in &self.attached_protos {
proto.register(&self.network)
}
}
fn stop_network(&self) {