mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-23 05:01:08 +00:00
Remove Proposer from Service (#1171)
* Remove Proposer from Service Refs #1021, #1158
This commit is contained in:
committed by
GitHub
parent
9ee6bdd203
commit
c27c613445
Generated
+1
@@ -1733,6 +1733,7 @@ dependencies = [
|
||||
"substrate-cli 0.3.0",
|
||||
"substrate-client 0.1.0",
|
||||
"substrate-consensus-aura 0.1.0",
|
||||
"substrate-consensus-common 0.1.0",
|
||||
"substrate-finality-grandpa 0.1.0",
|
||||
"substrate-keystore 0.1.0",
|
||||
"substrate-network 0.1.0",
|
||||
|
||||
@@ -63,7 +63,7 @@ use std::collections::HashMap;
|
||||
#[doc(hidden)]
|
||||
pub use std::{ops::Deref, result::Result, sync::Arc};
|
||||
use futures::prelude::*;
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use parking_lot::Mutex;
|
||||
use keystore::Store as Keystore;
|
||||
use client::BlockchainEvents;
|
||||
use runtime_primitives::traits::{Header, As};
|
||||
@@ -80,7 +80,6 @@ pub use chain_spec::{ChainSpec, Properties};
|
||||
pub use transaction_pool::txpool::{self, Pool as TransactionPool, Options as TransactionPoolOptions, ChainApi, IntoPoolError};
|
||||
pub use client::ExecutionStrategy;
|
||||
|
||||
use consensus_common::offline_tracker::OfflineTracker;
|
||||
pub use consensus::ProposerFactory;
|
||||
pub use components::{ServiceFactory, FullBackend, FullExecutor, LightBackend,
|
||||
LightExecutor, Components, PoolApi, ComponentClient,
|
||||
@@ -105,7 +104,6 @@ pub struct Service<Components: components::Components> {
|
||||
signal: Option<Signal>,
|
||||
/// Configuration of this Service
|
||||
pub config: FactoryFullConfiguration<Components::Factory>,
|
||||
proposer: Arc<ProposerFactory<ComponentClient<Components>, Components::TransactionPoolApi>>,
|
||||
_rpc_http: Option<rpc::HttpServer>,
|
||||
_rpc_ws: Option<Mutex<rpc::WsServer>>, // WsServer is not `Sync`, but the service needs to be.
|
||||
_telemetry: Option<tel::Telemetry>,
|
||||
@@ -249,13 +247,6 @@ impl<Components> Service<Components>
|
||||
task_executor.clone(), transaction_pool.clone()
|
||||
)?;
|
||||
|
||||
let proposer = Arc::new(ProposerFactory {
|
||||
client: client.clone(),
|
||||
transaction_pool: transaction_pool.clone(),
|
||||
offline: Arc::new(RwLock::new(OfflineTracker::new())),
|
||||
force_delay: 0 // FIXME: allow this to be configured
|
||||
});
|
||||
|
||||
// Telemetry
|
||||
let telemetry = match config.telemetry_url.clone() {
|
||||
Some(url) => {
|
||||
@@ -290,7 +281,6 @@ impl<Components> Service<Components>
|
||||
signal: Some(signal),
|
||||
keystore: keystore,
|
||||
config,
|
||||
proposer,
|
||||
exit,
|
||||
_rpc_http: rpc_http,
|
||||
_rpc_ws: rpc_ws.map(Mutex::new),
|
||||
@@ -318,13 +308,6 @@ impl<Components> Service<Components> where Components: components::Components {
|
||||
self.client.clone()
|
||||
}
|
||||
|
||||
/// Get shared proposer instance
|
||||
pub fn proposer(&self)
|
||||
-> Arc<ProposerFactory<ComponentClient<Components>, Components::TransactionPoolApi>>
|
||||
{
|
||||
self.proposer.clone()
|
||||
}
|
||||
|
||||
/// Get shared network instance.
|
||||
pub fn network(&self) -> Arc<components::NetworkService<Components::Factory>> {
|
||||
self.network.as_ref().expect("self.network always Some").clone()
|
||||
|
||||
@@ -24,6 +24,7 @@ substrate-service = { path = "../../core/service" }
|
||||
substrate-transaction-pool = { path = "../../core/transaction-pool" }
|
||||
substrate-network = { path = "../../core/network" }
|
||||
substrate-consensus-aura = { path = "../../core/consensus/aura" }
|
||||
substrate-consensus-common = { path = "../../core/consensus/common" }
|
||||
substrate-finality-grandpa = { path = "../../core/finality-grandpa" }
|
||||
sr-primitives = { path = "../../core/sr-primitives" }
|
||||
node-executor = { path = "../executor" }
|
||||
|
||||
@@ -33,6 +33,7 @@ extern crate substrate_transaction_pool as transaction_pool;
|
||||
#[macro_use]
|
||||
extern crate substrate_network as network;
|
||||
extern crate substrate_consensus_aura as consensus;
|
||||
extern crate substrate_consensus_common as consensus_common;
|
||||
extern crate substrate_client as client;
|
||||
extern crate substrate_finality_grandpa as grandpa;
|
||||
extern crate node_primitives;
|
||||
@@ -44,6 +45,7 @@ extern crate substrate_keystore;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate structopt;
|
||||
extern crate parking_lot;
|
||||
|
||||
pub use cli::error;
|
||||
pub mod chain_spec;
|
||||
|
||||
@@ -28,9 +28,11 @@ use substrate_service::{
|
||||
};
|
||||
use node_executor;
|
||||
use consensus::{import_queue, start_aura, Config as AuraConfig, AuraImportQueue, NothingExtra};
|
||||
use consensus_common::offline_tracker::OfflineTracker;
|
||||
use primitives::ed25519::Pair;
|
||||
use client;
|
||||
use std::time::Duration;
|
||||
use parking_lot::RwLock;
|
||||
use grandpa;
|
||||
|
||||
const AURA_SLOT_DURATION: u64 = 6;
|
||||
@@ -99,6 +101,12 @@ construct_service_factory! {
|
||||
}
|
||||
if !service.config.custom.grandpa_authority_only {
|
||||
info!("Using authority key {}", key.public());
|
||||
let proposer = Arc::new(substrate_service::ProposerFactory {
|
||||
client: service.client(),
|
||||
transaction_pool: service.transaction_pool(),
|
||||
offline: Arc::new(RwLock::new(OfflineTracker::new())),
|
||||
force_delay: 0 // FIXME: allow this to be configured https://github.com/paritytech/substrate/issues/1170
|
||||
});
|
||||
executor.spawn(start_aura(
|
||||
AuraConfig {
|
||||
local_key: Some(key),
|
||||
@@ -106,7 +114,7 @@ construct_service_factory! {
|
||||
},
|
||||
service.client(),
|
||||
block_import.clone(),
|
||||
service.proposer(),
|
||||
proposer,
|
||||
service.network(),
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user