Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions availability-store/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use std::thread;
use log::{error, info, trace, warn};
use sp_blockchain::{Result as ClientResult};
use sp_runtime::traits::{Header as HeaderT, ProvideRuntimeApi};
use sp_api::{ApiExt, ApiErrorFor};
use sp_api::ApiExt;
use client::{
BlockchainEvents, BlockBody,
blockchain::ProvideCache,
Expand Down Expand Up @@ -214,20 +214,9 @@ where
{
let extrinsics = client.block_body(block)?;
Ok(match extrinsics {
Some(extrinsics) => {
let api = client.runtime_api();

if api.has_api_with::<dyn ParachainHost<Block, Error = ApiErrorFor<P, Block>>, _>(
parent,
|version| version >= 2,
).map_err(|_| ConsensusError::ChainLookup("outdated runtime API".into()))? {
api.get_heads(&parent, extrinsics)
.map_err(|_| ConsensusError::ChainLookup("".into()))?
.map(|v| v.into_iter())
} else {
None
}
}
Some(extrinsics) => client.runtime_api()
.get_heads(&parent, extrinsics).map_err(|_| ConsensusError::ChainLookup("".into()))?
.and_then(|v| Some(v.into_iter())),
None => None,
})
}
Expand Down
1 change: 0 additions & 1 deletion primitives/src/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,6 @@ use runtime_primitives::traits::{Block as BlockT};

sp_api::decl_runtime_apis! {
/// The API for querying the state of parachains on-chain.
#[api_version(2)]
pub trait ParachainHost {
/// Get the current validators.
fn validators() -> Vec<ValidatorId>;
Expand Down