mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 09:21:05 +00:00
Clean up the basic-authorship crate (#3206)
* Switch consensus-common to new futures * Fix tests * More tests fixing * Make Proposer, OnSlot and SyncOracle mut * Make the Environment mut as well * Fix test * Fix Babe tests * Babe fixes * Fix CLI service tests * Fix Babe tests * Remove unnecessary trait bound * Inline the code of BlockBuilder and AuthoringApi * Remove warning lint * Bounds simplification * Imports simplification * Don't panic on bad generated block * Code style * Add doc example * Remove dependency on aura * Order dependencies alphabetically * Minor style
This commit is contained in:
committed by
DemiMarie-parity
parent
ba55d31d44
commit
9370a4a6b6
@@ -154,7 +154,7 @@ pub struct BabeParams<C, E, I, SO, SC> {
|
||||
pub block_import: I,
|
||||
|
||||
/// The environment
|
||||
pub env: Arc<E>,
|
||||
pub env: E,
|
||||
|
||||
/// A sync oracle
|
||||
pub sync_oracle: SO,
|
||||
@@ -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<Mutex<I>>,
|
||||
env: Arc<E>,
|
||||
env: E,
|
||||
local_key: Arc<sr25519::Pair>,
|
||||
sync_oracle: SO,
|
||||
force_authoring: bool,
|
||||
@@ -245,14 +245,13 @@ impl<Hash, H, B, C, E, I, Error, SO> SlotWorker<B> for BabeWorker<C, E, I, SO> w
|
||||
type OnSlot = Pin<Box<dyn Future<Output = Result<(), consensus_common::Error>> + Send>>;
|
||||
|
||||
fn on_slot(
|
||||
&self,
|
||||
&mut self,
|
||||
chain_head: B::Header,
|
||||
slot_info: SlotInfo,
|
||||
) -> Self::OnSlot {
|
||||
let pair = self.local_key.clone();
|
||||
let ref client = self.client;
|
||||
let block_import = self.block_import.clone();
|
||||
let ref env = self.env;
|
||||
|
||||
let (timestamp, slot_number, slot_duration) =
|
||||
(slot_info.timestamp, slot_info.number, slot_info.duration);
|
||||
@@ -305,7 +304,7 @@ impl<Hash, H, B, C, E, I, Error, SO> SlotWorker<B> for BabeWorker<C, E, I, SO> w
|
||||
);
|
||||
|
||||
// we are the slot author. make a block and sign it.
|
||||
let proposer = match env.init(&chain_head) {
|
||||
let mut proposer = match self.env.init(&chain_head) {
|
||||
Ok(p) => p,
|
||||
Err(e) => {
|
||||
warn!(target: "babe",
|
||||
|
||||
Reference in New Issue
Block a user