mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 07:01:05 +00:00
add a current_epoch to BabeApi (#7789)
* add a `current_epoch` to BabeApi * add current_epoch_start back again * fix node-runtime * bump spec version
This commit is contained in:
committed by
GitHub
parent
6dfad0921b
commit
9164cde499
@@ -43,7 +43,7 @@ use sp_timestamp::OnTimestampSet;
|
||||
use sp_consensus_babe::{
|
||||
digests::{NextConfigDescriptor, NextEpochDescriptor, PreDigest},
|
||||
inherents::{BabeInherentData, INHERENT_IDENTIFIER},
|
||||
BabeAuthorityWeight, ConsensusLog, EquivocationProof, SlotNumber, BABE_ENGINE_ID,
|
||||
BabeAuthorityWeight, ConsensusLog, Epoch, EquivocationProof, SlotNumber, BABE_ENGINE_ID,
|
||||
};
|
||||
use sp_consensus_vrf::schnorrkel;
|
||||
use sp_inherents::{InherentData, InherentIdentifier, MakeFatalError, ProvideInherent};
|
||||
@@ -486,6 +486,17 @@ impl<T: Config> Module<T> {
|
||||
(EpochIndex::get() * T::EpochDuration::get()) + GenesisSlot::get()
|
||||
}
|
||||
|
||||
/// Produces information about the current epoch.
|
||||
pub fn current_epoch() -> Epoch {
|
||||
Epoch {
|
||||
epoch_index: EpochIndex::get(),
|
||||
start_slot: Self::current_epoch_start(),
|
||||
duration: T::EpochDuration::get(),
|
||||
authorities: Self::authorities(),
|
||||
randomness: Self::randomness(),
|
||||
}
|
||||
}
|
||||
|
||||
fn deposit_consensus<U: Encode>(new: U) {
|
||||
let log: DigestItem<T::Hash> = DigestItem::Consensus(BABE_ENGINE_ID, new.encode());
|
||||
<frame_system::Module<T>>::deposit_log(log.into())
|
||||
|
||||
Reference in New Issue
Block a user