Skip to main content

InMemoryStakingStore

Struct InMemoryStakingStore 

Source
pub struct InMemoryStakingStore { /* private fields */ }
Expand description

In-memory staking store for testing and demos.

Implementations§

Trait Implementations§

Source§

impl Default for InMemoryStakingStore

Source§

fn default() -> InMemoryStakingStore

Returns the “default value” for a type. Read more
Source§

impl StakingStore for InMemoryStakingStore

Source§

fn get_validator(&self, id: ValidatorId) -> Option<ValidatorState>

Source§

fn set_validator(&mut self, id: ValidatorId, state: ValidatorState)

Source§

fn remove_validator(&mut self, id: ValidatorId)

Source§

fn all_validator_ids(&self) -> Vec<ValidatorId>

Source§

fn get_stake(&self, staker: &[u8], validator: ValidatorId) -> Option<StakeEntry>

Source§

fn set_stake( &mut self, staker: &[u8], validator: ValidatorId, entry: StakeEntry, )

Source§

fn remove_stake(&mut self, staker: &[u8], validator: ValidatorId)

Source§

fn stakers_of(&self, validator: ValidatorId) -> Vec<(Vec<u8>, StakeEntry)>

Return all (staker_address, entry) pairs for a given validator.
Source§

fn push_unbonding(&mut self, entry: UnbondingEntry)

Append an entry to the unbonding queue.
Source§

fn drain_mature_unbondings( &mut self, current_height: u64, ) -> Vec<UnbondingEntry>

Remove and return all entries whose completion_height <= current_height.
Source§

fn all_unbondings(&self) -> Vec<UnbondingEntry>

Return all pending unbonding entries (for slashing).
Source§

fn replace_unbondings(&mut self, entries: Vec<UnbondingEntry>)

Replace the entire unbonding queue (used after slashing adjustments).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.