[][src]Struct hbbft::honey_badger::HoneyBadger

pub struct HoneyBadger<C, N> { /* fields omitted */ }

An instance of the Honey Badger Byzantine fault tolerant consensus algorithm.

Methods

impl<C, N> HoneyBadger<C, N> where
    C: Contribution + Serialize + DeserializeOwned,
    N: NodeIdT
[src]

pub fn builder(netinfo: Arc<NetworkInfo<N>>) -> HoneyBadgerBuilder<C, N>[src]

Returns a new HoneyBadgerBuilder configured to use the node IDs and cryptographic keys specified by netinfo.

pub fn propose<R: Rng>(
    &mut self,
    proposal: &C,
    rng: &mut R
) -> Result<Step<C, N>>
[src]

Proposes a contribution in the current epoch.

Returns an error if we already made a proposal in this epoch.

If we are the only validator, this will immediately output a batch, containing our proposal.

pub fn handle_message(
    &mut self,
    sender_id: &N,
    message: Message<N>
) -> Result<Step<C, N>>
[src]

Handles a message received from sender_id.

This must be called with every message we receive from another node.

pub fn has_input(&self) -> bool[src]

Returns true if input for the current epoch has already been provided.

pub fn get_encryption_schedule(&self) -> EncryptionSchedule[src]

Returns the current encryption schedule that determines in which epochs contributions are encrypted.

pub fn next_epoch(&self) -> u64[src]

Returns the epoch of the next batch that will be output.

pub fn received_proposals(&self) -> usize[src]

Returns the number of validators from which we have already received a proposal for the current epoch.

This can be used to find out whether our node is stalling progress. Depending on the application logic, nodes may e.g. only propose when they have any pending transactions. In that case, they should repeatedly call this method: if it returns f + 1 or more, that means at least one correct node has proposed a contribution. In that case, we might want to propose one, too, even if it's empty, to avoid unnecessarily delaying the next batch.

pub fn max_future_epochs(&self) -> u64[src]

Returns the maximum future epochs of the Honey Badger algorithm instance.

pub fn params(&self) -> &Params[src]

Returns the parameters controlling Honey Badger's behavior and performance.

Trait Implementations

impl<C, N> Epoched for HoneyBadger<C, N> where
    C: Contribution + Serialize + DeserializeOwned,
    N: NodeIdT
[src]

type Epoch = u64

Type of epoch.

impl<C, N> ConsensusProtocol for HoneyBadger<C, N> where
    C: Contribution + Serialize + DeserializeOwned,
    N: NodeIdT
[src]

type NodeId = N

Unique node identifier.

type Input = C

The input provided by the user.

type Output = Batch<C, N>

The output type. Some algorithms return an output exactly once, others return multiple times. Read more

type Message = Message<N>

The messages that need to be exchanged between the instances in the participating nodes.

type Error = Error

The errors that can occur during execution.

type FaultKind = FaultKind

The kinds of message faults that can be detected during execution.

impl<C, N> SenderQueueableConsensusProtocol for HoneyBadger<C, N> where
    C: Contribution + Serialize + DeserializeOwned,
    N: NodeIdT
[src]

impl<C, N> Debug for HoneyBadger<C, N> where
    C: Debug,
    N: Debug
[src]

Auto Trait Implementations

impl<C, N> Send for HoneyBadger<C, N> where
    C: Send,
    N: Send + Sync

impl<C, N> Sync for HoneyBadger<C, N> where
    C: Sync,
    N: Send + Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.