Skip to content
Permalink
Browse files

retrieve the number of slots per epoch in a given TimeEra via a func

  • Loading branch information...
NicolasDP committed May 13, 2019
1 parent 028ddda commit 2c9a30e6b4b3ce3088bf17ee48c9bade935abf77
Showing with 7 additions and 2 deletions.
  1. +1 −1 chain-impl-mockchain/src/date.rs
  2. +6 −1 chain-time/src/era.rs
@@ -25,7 +25,7 @@ impl BlockDate {

/// Get the slot following this one.
pub fn next(&self, era: &TimeEra) -> BlockDate {
let epoch_duration = era.slots_per_epoch;
let epoch_duration = era.slots_per_epoch();
assert!(self.slot_id < epoch_duration);
if self.slot_id + 1 == epoch_duration {
BlockDate {
@@ -23,7 +23,7 @@ pub struct EpochPosition {
pub struct TimeEra {
epoch_start: Epoch,
slot_start: Slot,
pub slots_per_epoch: u32,
slots_per_epoch: u32,
}

impl TimeEra {
@@ -36,6 +36,11 @@ impl TimeEra {
}
}

/// retrieve the number of slots in an epoch during a given Epoch
pub fn slots_per_epoch(&self) -> u32 {
self.slots_per_epoch
}

/// Try to return the epoch/inner-epoch-slot associated.
///
/// If the slot in parameter is before the beginning of this era, then

0 comments on commit 2c9a30e

Please sign in to comment.
You can’t perform that action at this time.