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§
fn get_chain(&self) -> Result<&Arc<BlockchainClient>>
Provided Methods§
Sourceasync fn should_serve(&self) -> bool
async fn should_serve(&self) -> bool
Whether this node should serve requests.
Sourceasync fn forward_to_leader(
&self,
tx_hash: Hash,
tx_data: Bytes,
rpc_client: &RpcClientApp,
) -> Result<Hash, StratusError>
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.