stratus::eth::follower::consensus

Trait Consensus

Source
pub trait Consensus: Send + Sync {
    // Required methods
    fn get_chain(&self) -> Result<&Arc<BlockchainClient>>;
    async fn lag(&self) -> Result<u64>;

    // Provided methods
    async fn should_serve(&self) -> bool { ... }
    async fn forward_to_leader(
        &self,
        tx_hash: Hash,
        tx_data: Bytes,
        rpc_client: &RpcClientApp,
    ) -> Result<Hash, StratusError> { ... }
}

Required Methods§

Source

fn get_chain(&self) -> Result<&Arc<BlockchainClient>>

Source

async fn lag(&self) -> Result<u64>

Get the lag between this node and the leader.

Provided Methods§

Source

async fn should_serve(&self) -> bool

Whether this node should serve requests.

Source

async fn forward_to_leader( &self, tx_hash: Hash, tx_data: Bytes, rpc_client: &RpcClientApp, ) -> Result<Hash, StratusError>

Forwards a transaction to leader.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§