pub struct PotState { /* private fields */ }
Expand description
Global PoT state.
Maintains the accurate information about PoT state and current tip.
Implementations§
Source§impl PotState
impl PotState
Sourcepub fn new(
next_slot_input: PotNextSlotInput,
parameters_change: Option<PotParametersChange>,
verifier: PotVerifier,
) -> Self
pub fn new( next_slot_input: PotNextSlotInput, parameters_change: Option<PotParametersChange>, verifier: PotVerifier, ) -> Self
Create a new PoT state
Sourcepub fn next_slot_input(&self) -> PotNextSlotInput
pub fn next_slot_input(&self) -> PotNextSlotInput
PoT input for the next slot
Sourcepub fn try_extend(
&self,
expected_existing_next_slot_input: PotNextSlotInput,
best_slot: SlotNumber,
best_output: PotOutput,
maybe_updated_parameters_change: Option<Option<PotParametersChange>>,
) -> Result<PotNextSlotInput, PotNextSlotInput>
pub fn try_extend( &self, expected_existing_next_slot_input: PotNextSlotInput, best_slot: SlotNumber, best_output: PotOutput, maybe_updated_parameters_change: Option<Option<PotParametersChange>>, ) -> Result<PotNextSlotInput, PotNextSlotInput>
Extend PoT chain if it matches provided expected next slot input.
Returns Ok(new_next_slot_input)
if PoT chain was extended successfully and
Err(existing_next_slot_input)
in case the state was changed in the meantime.
Sourcepub fn set_known_good_output(
&self,
slot: SlotNumber,
output: PotOutput,
updated_parameters_change: Option<PotParametersChange>,
) -> PotStateSetOutcome
pub fn set_known_good_output( &self, slot: SlotNumber, output: PotOutput, updated_parameters_change: Option<PotParametersChange>, ) -> PotStateSetOutcome
Set known good output for time slot, overriding PoT chain if it doesn’t match the provided output.
This is typically called with information obtained from received block. It typically lags behind PoT tip and is used as a correction mechanism in case PoT reorg is needed.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PotState
impl !RefUnwindSafe for PotState
impl Send for PotState
impl Sync for PotState
impl Unpin for PotState
impl !UnwindSafe for PotState
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more