hotstuff_rs::block_sync::client

Struct BlockSyncClientState

source
struct BlockSyncClientState {
    available_sync_servers: HashMap<VerifyingKey, BlockHeight>,
    blacklist: VecDeque<(VerifyingKey, Instant)>,
    last_progress_or_sync_time: Instant,
    highest_pc_view: ViewNumber,
}

Fields§

§available_sync_servers: HashMap<VerifyingKey, BlockHeight>

Replicas that are currently available to be sync servers,

§blacklist: VecDeque<(VerifyingKey, Instant)>

A list of replicas (identified by their public addresses) that will be ignored by the block sync client until the paired instant. “Ignored” here means that:

  • These replicas will not be selected as sync servers.
  • Advertise messages received from these replicas will be ignored.
§last_progress_or_sync_time: Instant

The most recent instant in time when either:

  1. Progress was made (the highest PC was updated).
  2. The block sync procedure was completed (not necessarily successfully).
§highest_pc_view: ViewNumber

Cached value of block_tree.highest_pc().view.

Implementations§

source§

impl BlockSyncClientState

source

fn initialize() -> Self

Initialize the internal state of the block sync client.

source

fn blacklist_contains_server_address(&self, sync_server: &VerifyingKey) -> bool

Check if a given server address is in the blacklist.

source

fn register_or_update_sync_server( &mut self, sync_server: VerifyingKey, highest_committed_block_height: BlockHeight, )

source

fn blacklist_sync_server( &mut self, sync_server: VerifyingKey, blacklist_expiry_time: Duration, )

Blacklist a given sync server by:

  1. Removing it from available sync servers,
  2. Adding it to the blacklist.
source

fn remove_expired_blacklisted_servers(&mut self)

Remove all sync servers whose blacklisting has expired from the blacklist.

source

fn random_sync_server( &self, min_highest_committed_block_height: &Option<BlockHeight>, ) -> Option<VerifyingKey>

Select a random sync server from available sync servers, with the condition that the sync server must have advertised a block higher than highest_committed_block_height.

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> Same for T

source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V