Generalize the Consensus Infrastructure (#883)

* Split out Consensus
* Supply ImportQueue through network-service
  - simplify ImportQueue.import_blocks
  - remove Deadlock on import_block
  - Adding Verifier-Trait
  - Implement import_queue provisioning in service; allow cli to import
* Allow to actually customize import queue
* Consensus Gossip: Cache Message hash per Topic
This commit is contained in:
Benjamin Kampmann
2018-10-16 13:40:33 +02:00
committed by GitHub
parent a24e61cb29
commit ac4bcf879f
61 changed files with 1937 additions and 3306 deletions
+4 -4
View File
@@ -47,7 +47,7 @@ use service::{
FactoryExtrinsic,
};
use network::{NetworkConfiguration, NonReservedPeerMode, Protocol, SyncProvider, ManageNetwork};
use client::{BlockOrigin, JustifiedHeader};
use client::ImportBlock;
use sr_primitives::traits::As;
use sr_primitives::generic::BlockId;
@@ -216,7 +216,7 @@ pub fn connectivity<F: ServiceFactory>(spec: FactoryChainSpec<F>) {
pub fn sync<F, B, E>(spec: FactoryChainSpec<F>, block_factory: B, extrinsic_factory: E)
where
F: ServiceFactory,
B: Fn(&F::FullService) -> (JustifiedHeader<F::Block>, Option<Vec<FactoryExtrinsic<F>>>),
B: Fn(&F::FullService) -> ImportBlock<F::Block>,
E: Fn(&F::FullService) -> FactoryExtrinsic<F>,
{
const NUM_NODES: u32 = 10;
@@ -230,8 +230,8 @@ where
if i % 128 == 0 {
info!("Generating #{}", i);
}
let (header, body) = block_factory(&first_service);
first_service.client().import_block(BlockOrigin::File, header, body, true).expect("Error importing test block");
let import_data = block_factory(&first_service);
first_service.client().import_block(import_data, None).expect("Error importing test block");
}
first_service.network().node_id().unwrap()
};