mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 22:51:03 +00:00
epoch-changes: separate epoch header with epoch data (#4881)
* fork-tree: prune returns all pruned node data * epoch-changes: split EpochHeader vs epoch data * EpochChanges::viable_epoch and add missing comments * Incoperate the new epoch_changes interface for BABE * Fix BABE tests * Fix fork-tree pruning issue * Fix tests * Fix pruning algorithm * fork-tree: implement map function for mapping one value type to another * Add migration script for new epoch changes scheme * Update utils/fork-tree/src/lib.rs Co-Authored-By: André Silva <andre.beat@gmail.com> * Update client/consensus/slots/src/lib.rs Co-Authored-By: André Silva <andre.beat@gmail.com> * Remove authorities_len.is_none check, which is duplicate of unwrap_or(false) * Update client/consensus/epochs/src/lib.rs Co-Authored-By: André Silva <andre.beat@gmail.com> * Update client/consensus/epochs/src/lib.rs Co-Authored-By: André Silva <andre.beat@gmail.com> * No trailing ; for return statement * Use VERSION_KEY for migration * Fix issues that removed nodes are not properly added into removed list * Add comments indicating end_slot is non-inclusive * fork-tree: use &mut F for map type declaration * Add tests for v0 epoch_changes migration * Fix babe RPC tests Co-authored-by: André Silva <andre.beat@gmail.com>
This commit is contained in:
@@ -94,7 +94,8 @@ pub trait SimpleSlotWorker<B: BlockT> {
|
||||
fn epoch_data(&self, header: &B::Header, slot_number: u64) -> Result<Self::EpochData, sp_consensus::Error>;
|
||||
|
||||
/// Returns the number of authorities given the epoch data.
|
||||
fn authorities_len(&self, epoch_data: &Self::EpochData) -> usize;
|
||||
/// None indicate that the authorities information is incomplete.
|
||||
fn authorities_len(&self, epoch_data: &Self::EpochData) -> Option<usize>;
|
||||
|
||||
/// Tries to claim the given slot, returning an object with claim data if successful.
|
||||
fn claim_slot(
|
||||
@@ -194,7 +195,10 @@ pub trait SimpleSlotWorker<B: BlockT> {
|
||||
|
||||
let authorities_len = self.authorities_len(&epoch_data);
|
||||
|
||||
if !self.force_authoring() && self.sync_oracle().is_offline() && authorities_len > 1 {
|
||||
if !self.force_authoring() &&
|
||||
self.sync_oracle().is_offline() &&
|
||||
authorities_len.map(|a| a > 1).unwrap_or(false)
|
||||
{
|
||||
debug!(target: self.logging_target(), "Skipping proposal slot. Waiting for the network.");
|
||||
telemetry!(
|
||||
CONSENSUS_DEBUG;
|
||||
|
||||
Reference in New Issue
Block a user