Skip to main content

DriverCb

Trait DriverCb 

Source
pub trait DriverCb {
    // Required methods
    fn received_envelope(&mut self, env: &SCPEnvelope);
    fn driver_calling_back(&mut self, cb: DriverCallback);
    fn set_state_from_envelope(
        &mut self,
        slot_index: SlotIndex,
        envelope: &SCPEnvelope,
    );
}
Expand description

The entry points through which the application drives the protocol.

The kernel does not verify envelope signatures. Every envelope passed to received_envelope or set_state_from_envelope must already be authenticated by the caller, normally with scp_util::verify_envelope, which checks the signature against the statement’s node_id:

if scp_util::verify_envelope(env).is_ok() {
    kernel.received_envelope(env);
}

An unverified envelope lets whoever sent it speak for any node in the quorum set.

Required Methods§

Source

fn received_envelope(&mut self, env: &SCPEnvelope)

Processes an envelope received from a peer. The envelope must be authenticated; see the trait documentation.

Source

fn driver_calling_back(&mut self, cb: DriverCallback)

Delivers an expired nomination or ballot timer, with the callback the driver was given in Driver::start_timer.

Source

fn set_state_from_envelope( &mut self, slot_index: SlotIndex, envelope: &SCPEnvelope, )

Restores a slot’s state from one of this node’s own earlier envelopes, for example after a restart. The envelope must be authenticated like any other.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'a, C: Consensus, D: Driver> DriverCb for StellarProto<'a, C, D>