mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 09:21:04 +00:00
Update Substrate & Polkadot (#557)
* Update Substrate & Polkadot * Format * Update again
This commit is contained in:
@@ -16,19 +16,18 @@
|
||||
|
||||
use std::{marker::PhantomData, sync::Arc};
|
||||
|
||||
use sc_consensus::{
|
||||
import_queue::{BasicQueue, Verifier as VerifierT},
|
||||
BlockImport, BlockImportParams,
|
||||
};
|
||||
use sp_api::ProvideRuntimeApi;
|
||||
use sp_block_builder::BlockBuilder as BlockBuilderApi;
|
||||
use sp_blockchain::Result as ClientResult;
|
||||
use sp_consensus::{
|
||||
error::Error as ConsensusError,
|
||||
import_queue::{BasicQueue, CacheKeyId, Verifier as VerifierT},
|
||||
BlockImport, BlockImportParams, BlockOrigin,
|
||||
};
|
||||
use sp_consensus::{error::Error as ConsensusError, CacheKeyId};
|
||||
use sp_inherents::{CreateInherentDataProviders, InherentDataProvider};
|
||||
use sp_runtime::{
|
||||
generic::BlockId,
|
||||
traits::{Block as BlockT, Header as HeaderT},
|
||||
Justifications,
|
||||
};
|
||||
|
||||
/// A verifier that just checks the inherents.
|
||||
@@ -59,10 +58,7 @@ where
|
||||
{
|
||||
async fn verify(
|
||||
&mut self,
|
||||
origin: BlockOrigin,
|
||||
header: Block::Header,
|
||||
justifications: Option<Justifications>,
|
||||
mut body: Option<Vec<Block::Extrinsic>>,
|
||||
mut block_params: BlockImportParams<Block, ()>,
|
||||
) -> Result<
|
||||
(
|
||||
BlockImportParams<Block, ()>,
|
||||
@@ -70,10 +66,10 @@ where
|
||||
),
|
||||
String,
|
||||
> {
|
||||
if let Some(inner_body) = body.take() {
|
||||
if let Some(inner_body) = block_params.body.take() {
|
||||
let inherent_data_providers = self
|
||||
.create_inherent_data_providers
|
||||
.create_inherent_data_providers(*header.parent_hash(), ())
|
||||
.create_inherent_data_providers(*block_params.header.parent_hash(), ())
|
||||
.await
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
@@ -81,13 +77,13 @@ where
|
||||
.create_inherent_data()
|
||||
.map_err(|e| format!("{:?}", e))?;
|
||||
|
||||
let block = Block::new(header.clone(), inner_body);
|
||||
let block = Block::new(block_params.header.clone(), inner_body);
|
||||
|
||||
let inherent_res = self
|
||||
.client
|
||||
.runtime_api()
|
||||
.check_inherents(
|
||||
&BlockId::Hash(*header.parent_hash()),
|
||||
&BlockId::Hash(*block.header().parent_hash()),
|
||||
block.clone(),
|
||||
inherent_data,
|
||||
)
|
||||
@@ -106,17 +102,12 @@ where
|
||||
}
|
||||
|
||||
let (_, inner_body) = block.deconstruct();
|
||||
body = Some(inner_body);
|
||||
block_params.body = Some(inner_body);
|
||||
}
|
||||
|
||||
let post_hash = Some(header.hash());
|
||||
let mut block_import_params = BlockImportParams::new(origin, header);
|
||||
block_import_params.body = body;
|
||||
block_import_params.justifications = justifications;
|
||||
block_params.post_hash = Some(block_params.header.hash());
|
||||
|
||||
block_import_params.post_hash = post_hash;
|
||||
|
||||
Ok((block_import_params, None))
|
||||
Ok((block_params, None))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user