Struct blockchain::EpochInfo
source · pub struct EpochInfo {
time_frame: TimeFrame,
epoch_leadership_schedule: Leadership,
epoch_rewards_info: Option<EpochRewardsInfo>,
}
Fields§
§time_frame: TimeFrame
the time frame applicable in the current branch of the blockchain
epoch_leadership_schedule: Leadership
the leadership used to validate the current header’s leader
this object will be shared between different Ref of the same epoch
epoch_rewards_info: Option<EpochRewardsInfo>
If present, this is the rewards info distributed at the beginning of the epoch. Useful to follow up on the reward distribution history
Implementations§
source§impl EpochInfo
impl EpochInfo
pub(crate) fn new( block0: &Block, ledger: &Ledger ) -> Result<Self, EpochInfoError>
pub(crate) fn chain( &self, leadership: Leadership, epoch_rewards_info: Option<EpochRewardsInfo> ) -> Self
pub fn check_header(&self, header: &Header) -> Result<(), EpochInfoError>
pub fn epoch(&self) -> u32
sourcepub fn slot_of(&self, date: BlockDate) -> Slot
pub fn slot_of(&self, date: BlockDate) -> Slot
get the slot for the given BlockDate
Having this available allows for better handling of the time scheduled of the given date.
sourcepub fn time_of(&self, date: BlockDate) -> Option<SystemTime>
pub fn time_of(&self, date: BlockDate) -> Option<SystemTime>
get the system time scheduled for the given block date
This function returns None
if the block date is not
within the time frame of this EpochInfo (i.e. the time
frame has changed)
pub fn epoch_leadership_schedule(&self) -> &Leadership
sourcepub fn epoch_rewards_info(&self) -> Option<&EpochRewardsInfo>
pub fn epoch_rewards_info(&self) -> Option<&EpochRewardsInfo>
access the rewards info that were distributed at the end of the previous epoch (and that are accessible/visible from this epoch only).