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 is_on_current_chain(
&self,
proof_slot_input: PotNextSlotInput,
proof_output: PotOutput,
) -> bool
pub fn is_on_current_chain( &self, proof_slot_input: PotNextSlotInput, proof_output: PotOutput, ) -> bool
Check whether a proof with proof_output for proof_slot_input belongs to the PoT chain
that is currently followed, either as one of the recent slots or as the next slot.
Recent slots are connected to the tip using previously verified proofs, so false is also
returned for proofs that can’t be connected this way.
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 !UnwindSafe for PotState
impl Forget for PotState
impl Move for PotState
impl Send for PotState
impl Sync for PotState
impl Unpin for PotState
impl UnsafeUnpin for PotStatewhere
Align1<u8>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
*const ArcInner<Mutex<RawMutex, LruMap<CacheKey, CacheValue>>> is !null: UnsafeUnpin,
PhantomData<Mutex<RawMutex, LruMap<CacheKey, CacheValue>>>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§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> ⓘ
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> ⓘ
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