mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 17:47:56 +00:00
Change the import queue traits to take &mut self instead of &self (#3058)
* SharedFinalityProofRequestBuilder -> BoxFinalityProofRequestBuilder * SharedThings -> BoxThings * Fix tests * build_request_data now takes &mut self * The other traits now also take &mut self * More or less fix tests * Fix tests * Fix more tests * Moar tests * Don't call make_block_import multiple time * Fix doctest
This commit is contained in:
committed by
Gavin Wood
parent
e729dbabbe
commit
d7b6720663
@@ -32,8 +32,8 @@ pub use digest::{BabePreDigest, BABE_VRF_PREFIX};
|
||||
pub use babe_primitives::*;
|
||||
pub use consensus_common::SyncOracle;
|
||||
use consensus_common::import_queue::{
|
||||
SharedBlockImport, SharedJustificationImport, SharedFinalityProofImport,
|
||||
SharedFinalityProofRequestBuilder,
|
||||
BoxBlockImport, BoxJustificationImport, BoxFinalityProofImport,
|
||||
BoxFinalityProofRequestBuilder,
|
||||
};
|
||||
use consensus_common::well_known_cache_keys::Id as CacheKeyId;
|
||||
use runtime_primitives::{generic, generic::{BlockId, OpaqueDigestItemId}, Justification};
|
||||
@@ -152,7 +152,7 @@ pub struct BabeParams<C, E, I, SO, SC> {
|
||||
pub select_chain: SC,
|
||||
|
||||
/// A block importer
|
||||
pub block_import: Arc<I>,
|
||||
pub block_import: I,
|
||||
|
||||
/// The environment
|
||||
pub env: Arc<E>,
|
||||
@@ -200,7 +200,7 @@ pub fn start_babe<B, C, SC, E, I, SO, Error, H>(BabeParams {
|
||||
{
|
||||
let worker = BabeWorker {
|
||||
client: client.clone(),
|
||||
block_import,
|
||||
block_import: Arc::new(Mutex::new(block_import)),
|
||||
env,
|
||||
local_key,
|
||||
sync_oracle: sync_oracle.clone(),
|
||||
@@ -220,7 +220,7 @@ pub fn start_babe<B, C, SC, E, I, SO, Error, H>(BabeParams {
|
||||
|
||||
struct BabeWorker<C, E, I, SO> {
|
||||
client: Arc<C>,
|
||||
block_import: Arc<I>,
|
||||
block_import: Arc<Mutex<I>>,
|
||||
env: Arc<E>,
|
||||
local_key: Arc<sr25519::Pair>,
|
||||
sync_oracle: SO,
|
||||
@@ -397,7 +397,7 @@ impl<Hash, H, B, C, E, I, Error, SO> SlotWorker<B> for BabeWorker<C, E, I, SO> w
|
||||
"hash_previously" => ?header_hash,
|
||||
);
|
||||
|
||||
if let Err(e) = block_import.import_block(import_block, Default::default()) {
|
||||
if let Err(e) = block_import.lock().import_block(import_block, Default::default()) {
|
||||
warn!(target: "babe", "Error with block built on {:?}: {:?}",
|
||||
parent_hash, e);
|
||||
telemetry!(CONSENSUS_WARN; "babe.err_with_block_built_on";
|
||||
@@ -829,10 +829,10 @@ fn initialize_authorities_cache<B, C>(client: &C) -> Result<(), ConsensusError>
|
||||
/// Start an import queue for the Babe consensus algorithm.
|
||||
pub fn import_queue<B, C, E>(
|
||||
config: Config,
|
||||
block_import: SharedBlockImport<B>,
|
||||
justification_import: Option<SharedJustificationImport<B>>,
|
||||
finality_proof_import: Option<SharedFinalityProofImport<B>>,
|
||||
finality_proof_request_builder: Option<SharedFinalityProofRequestBuilder<B>>,
|
||||
block_import: BoxBlockImport<B>,
|
||||
justification_import: Option<BoxJustificationImport<B>>,
|
||||
finality_proof_import: Option<BoxFinalityProofImport<B>>,
|
||||
finality_proof_request_builder: Option<BoxFinalityProofRequestBuilder<B>>,
|
||||
client: Arc<C>,
|
||||
inherent_data_providers: InherentDataProviders,
|
||||
) -> Result<(BabeImportQueue<B>, BabeLink), consensus_common::Error> where
|
||||
|
||||
Reference in New Issue
Block a user