mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 09:57:56 +00:00
Use correct CreateInherentDataProviders impl for manual seal (#8852)
* use correct CreateInherentDataProviders impl for manual seal * add babe inherent provider * move client into factory fn
This commit is contained in:
@@ -27,7 +27,9 @@ use sc_consensus_babe::BabeBlockImport;
|
||||
use sp_keystore::SyncCryptoStorePtr;
|
||||
use sp_keyring::sr25519::Keyring::Alice;
|
||||
use sp_consensus_babe::AuthorityId;
|
||||
use sc_consensus_manual_seal::{ConsensusDataProvider, consensus::babe::BabeConsensusDataProvider};
|
||||
use sc_consensus_manual_seal::{
|
||||
ConsensusDataProvider, consensus::babe::{BabeConsensusDataProvider, SlotTimestampProvider},
|
||||
};
|
||||
use sp_runtime::{traits::IdentifyAccount, MultiSigner, generic::Era};
|
||||
use node_cli::chain_spec::development_config;
|
||||
|
||||
@@ -59,10 +61,7 @@ impl ChainInfo for NodeTemplateChainInfo {
|
||||
Self::SelectChain,
|
||||
>;
|
||||
type SignedExtras = node_runtime::SignedExtra;
|
||||
type InherentDataProviders = (
|
||||
sp_timestamp::InherentDataProvider,
|
||||
sp_consensus_babe::inherents::InherentDataProvider,
|
||||
);
|
||||
type InherentDataProviders = (SlotTimestampProvider, sp_consensus_babe::inherents::InherentDataProvider);
|
||||
|
||||
fn signed_extras(from: <Self::Runtime as frame_system::Config>::AccountId) -> Self::SignedExtras {
|
||||
(
|
||||
@@ -139,20 +138,16 @@ impl ChainInfo for NodeTemplateChainInfo {
|
||||
.expect("failed to create ConsensusDataProvider");
|
||||
|
||||
Ok((
|
||||
client,
|
||||
client.clone(),
|
||||
backend,
|
||||
keystore.sync_keystore(),
|
||||
task_manager,
|
||||
Box::new(move |_, _| {
|
||||
let slot_duration = slot_duration.clone();
|
||||
let client = client.clone();
|
||||
async move {
|
||||
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
|
||||
let slot = sp_consensus_babe::inherents::InherentDataProvider::from_timestamp_and_duration(
|
||||
*timestamp,
|
||||
slot_duration.slot_duration(),
|
||||
);
|
||||
|
||||
Ok((timestamp, slot))
|
||||
let timestamp = SlotTimestampProvider::new(client.clone()).map_err(|err| format!("{:?}", err))?;
|
||||
let babe = sp_consensus_babe::inherents::InherentDataProvider::new(timestamp.slot().into());
|
||||
Ok((timestamp, babe))
|
||||
}
|
||||
}),
|
||||
Some(Box::new(consensus_data_provider)),
|
||||
|
||||
Reference in New Issue
Block a user