Struct jormungandr::blockcfg::Leadership
source · pub struct Leadership {
epoch: u32,
era: TimeEra,
inner: LeadershipConsensus,
}
Expand description
Leadership represent a given epoch and their associated leader or metadata.
Fields§
§epoch: u32
§era: TimeEra
§inner: LeadershipConsensus
Implementations§
source§impl Leadership
impl Leadership
pub fn new(epoch: u32, ledger: &Ledger) -> Leadership
pub fn stake_distribution(&self) -> Option<&StakeDistribution>
sourcepub fn date_at_slot(&self, slot_id: u32) -> BlockDate
pub fn date_at_slot(&self, slot_id: u32) -> BlockDate
Create a Block date given a leadership and a relative epoch slot
Panics
If the slot index is not valid given the leadership, out of bound date
sourcepub fn consensus(&self) -> &LeadershipConsensus
pub fn consensus(&self) -> &LeadershipConsensus
get the consensus associated with the Leadership
sourcepub fn verify(&self, block_header: &Header) -> Verification
pub fn verify(&self, block_header: &Header) -> Verification
Verify whether this header has been produced by a leader that fits with the leadership
sourcepub fn is_leader_for_date(
&self,
leader: &Leader,
date: BlockDate
) -> LeaderOutput
pub fn is_leader_for_date( &self, leader: &Leader, date: BlockDate ) -> LeaderOutput
Test that the given leader object is able to create a valid block for the leadership at a given date.
Auto Trait Implementations§
impl RefUnwindSafe for Leadership
impl Send for Leadership
impl Sync for Leadership
impl Unpin for Leadership
impl UnwindSafe for Leadership
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request