mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 08:11:03 +00:00
update substrate (#259)
* WIP * merging select_chain * WIP * update to point to gui-polkadot-master * Fix collator * update gui-polkadot-master and fix * fix unwraps * better returning an error
This commit is contained in:
committed by
Robert Habermeier
parent
ac2b9168ac
commit
6d778c99d2
@@ -27,16 +27,17 @@ use std::thread;
|
||||
use std::time::{Duration, Instant};
|
||||
use std::sync::Arc;
|
||||
|
||||
use client::{error::Result as ClientResult, BlockchainEvents, ChainHead, BlockBody};
|
||||
use client::{error::Result as ClientResult, BlockchainEvents, BlockBody};
|
||||
use client::block_builder::api::BlockBuilder;
|
||||
use client::blockchain::HeaderBackend;
|
||||
use primitives::ed25519;
|
||||
use consensus::SelectChain;
|
||||
use consensus_authorities::AuthoritiesApi;
|
||||
use extrinsic_store::Store as ExtrinsicStore;
|
||||
use futures::prelude::*;
|
||||
use primitives::ed25519;
|
||||
use polkadot_primitives::{Block, BlockId};
|
||||
use polkadot_primitives::parachain::{CandidateReceipt, ParachainHost};
|
||||
use extrinsic_store::Store as ExtrinsicStore;
|
||||
use runtime_primitives::traits::{ProvideRuntimeApi, Header as HeaderT};
|
||||
use consensus_authorities::AuthoritiesApi;
|
||||
|
||||
use tokio::runtime::TaskExecutor;
|
||||
use tokio::runtime::current_thread::Runtime as LocalRuntime;
|
||||
@@ -102,8 +103,9 @@ pub(crate) struct ServiceHandle {
|
||||
}
|
||||
|
||||
/// Create and start a new instance of the attestation service.
|
||||
pub(crate) fn start<C, N, P>(
|
||||
pub(crate) fn start<C, N, P, SC>(
|
||||
client: Arc<P>,
|
||||
select_chain: SC,
|
||||
parachain_validation: Arc<::ParachainValidation<C, N, P>>,
|
||||
thread_pool: TaskExecutor,
|
||||
key: Arc<ed25519::Pair>,
|
||||
@@ -112,12 +114,13 @@ pub(crate) fn start<C, N, P>(
|
||||
where
|
||||
C: Collators + Send + Sync + 'static,
|
||||
<C::Collation as IntoFuture>::Future: Send + 'static,
|
||||
P: BlockchainEvents<Block> + ChainHead<Block> + BlockBody<Block>,
|
||||
P: BlockchainEvents<Block> + BlockBody<Block>,
|
||||
P: ProvideRuntimeApi + HeaderBackend<Block> + Send + Sync + 'static,
|
||||
P::Api: ParachainHost<Block> + BlockBuilder<Block> + AuthoritiesApi<Block>,
|
||||
N: Network + Send + Sync + 'static,
|
||||
N::TableRouter: Send + 'static,
|
||||
<N::BuildTableRouter as IntoFuture>::Future: Send + 'static,
|
||||
SC: SelectChain<Block> + 'static,
|
||||
{
|
||||
const TIMER_DELAY: Duration = Duration::from_secs(5);
|
||||
const TIMER_INTERVAL: Duration = Duration::from_secs(30);
|
||||
@@ -159,14 +162,14 @@ pub(crate) fn start<C, N, P>(
|
||||
};
|
||||
|
||||
let prune_old_sessions = {
|
||||
let client = client.clone();
|
||||
let select_chain = select_chain.clone();
|
||||
let interval = Interval::new(
|
||||
Instant::now() + TIMER_DELAY,
|
||||
TIMER_INTERVAL,
|
||||
);
|
||||
|
||||
interval
|
||||
.for_each(move |_| match client.leaves() {
|
||||
.for_each(move |_| match select_chain.leaves() {
|
||||
Ok(leaves) => {
|
||||
parachain_validation.retain(|h| leaves.contains(h));
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user