mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-21 07:25:44 +00:00
consensus-slots: cleanup SlotDuration config (#10878)
* consensus-slots: cleanup the SlotDuration config * fix tests * address review comments
This commit is contained in:
@@ -62,7 +62,7 @@ pub mod ed25519 {
|
||||
pub type AuthorityId = app_ed25519::Public;
|
||||
}
|
||||
|
||||
pub use sp_consensus_slots::Slot;
|
||||
pub use sp_consensus_slots::{Slot, SlotDuration};
|
||||
|
||||
/// The `ConsensusEngineId` of AuRa.
|
||||
pub const AURA_ENGINE_ID: ConsensusEngineId = [b'a', b'u', b'r', b'a'];
|
||||
@@ -93,28 +93,3 @@ sp_api::decl_runtime_apis! {
|
||||
fn authorities() -> Vec<AuthorityId>;
|
||||
}
|
||||
}
|
||||
|
||||
/// Aura slot duration.
|
||||
///
|
||||
/// Internally stored as milliseconds.
|
||||
#[derive(sp_runtime::RuntimeDebug, Encode, Decode, PartialEq, Clone, Copy)]
|
||||
pub struct SlotDuration(u64);
|
||||
|
||||
impl SlotDuration {
|
||||
/// Initialize from the given milliseconds.
|
||||
pub fn from_millis(val: u64) -> Self {
|
||||
Self(val)
|
||||
}
|
||||
|
||||
/// Returns the slot duration in milli seconds.
|
||||
pub fn get(&self) -> u64 {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl sp_consensus::SlotData for SlotDuration {
|
||||
fn slot_duration(&self) -> std::time::Duration {
|
||||
std::time::Duration::from_millis(self.0)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user