Struct vapcore_light::client::Client[][src]

pub struct Client<T> { /* fields omitted */ }

Light client implementation.

Implementations

impl<T: ChainDataFetcher> Client<T>[src]

pub fn new(
    config: Config,
    db: Arc<dyn KeyValueDB>,
    chain_col: u32,
    spec: &Spec,
    fetcher: T,
    io_channel: IoChannel<ClientIoMessage<()>>,
    cache: Arc<Mutex<Cache>>
) -> Result<Self, Error>
[src]

Create a new Client.

pub fn read_hardcoded_sync(&self) -> Result<Option<SpecHardcodedSync>, Error>[src]

Generates the specifications for hardcoded sync. This is typically only called manually from time to time by a Tetsy developer in order to update the chain specifications.

Returns None if we are at the genesis block.

pub fn add_listener(&self, listener: Weak<dyn LightChainNotify>)[src]

Adds a new LightChainNotify listener.

pub fn import_header(&self, header: Header) -> VapcoreResult<H256>[src]

Import a header to the queue for additional verification.

pub fn status(&self, hash: &H256) -> BlockStatus[src]

Inquire about the status of a given header.

pub fn chain_info(&self) -> BlockChainInfo[src]

Get the chain info.

pub fn queue_info(&self) -> BlockQueueInfo[src]

Get the header queue info.

pub fn block_hash(&self, id: BlockId) -> Option<H256>[src]

Attempt to get a block hash by block id.

pub fn block_header(&self, id: BlockId) -> Option<Header>[src]

Get a block header by Id.

pub fn best_block_header(&self) -> Header[src]

Get the best block header.

pub fn score(&self, id: BlockId) -> Option<U256>[src]

Get a block’s chain score.

pub fn ancestry_iter(&self, start: BlockId) -> AncestryIter<'_>[src]

Get an iterator over a block and its ancestry.

pub fn signing_chain_id(&self) -> Option<u64>[src]

Get the signing chain id.

pub fn flush_queue(&self)[src]

Flush the header queue.

pub fn cht_root(&self, i: usize) -> Option<H256>[src]

Get the ith CHT root.

pub fn import_verified(&self)[src]

Import a set of pre-verified headers from the queue.

pub fn report(&self) -> ClientReport[src]

Get a report about blocks imported.

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

Get blockchain mem usage in bytes.

pub fn set_exit_handler<F>(&self, f: F) where
    F: Fn(String) + 'static + Send
[src]

Set a closure to call when the client wants to be restarted.

The parameter passed to the callback is the name of the new chain spec to use after the restart.

pub fn engine(&self) -> &Arc<dyn Engine>[src]

Get a handle to the verification engine.

pub fn latest_env_info(&self) -> EnvInfo[src]

Get the latest environment info.

pub fn env_info(&self, id: BlockId) -> Option<EnvInfo>[src]

Get environment info for a given block.

Trait Implementations

impl<T: ChainDataFetcher> ChainInfo for Client<T>[src]

impl<T: ChainDataFetcher> EngineClient for Client<T>[src]

impl<T: ChainDataFetcher> LightChainClient for Client<T>[src]

impl<T> Tick for Client<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for Client<T>

impl<T> Send for Client<T> where
    T: Send

impl<T> Sync for Client<T> where
    T: Sync

impl<T> Unpin for Client<T> where
    T: Unpin

impl<T> !UnwindSafe for Client<T>

Blanket Implementations

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

impl<T> AsLightClient for T where
    T: LightChainClient
[src]

type Client = T

The kind of light client this can be treated as.

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

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

impl<T> Erased for T

impl<T> From<T> for T[src]

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

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

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