# Struct ethcore_light::client::Client [−] [src]

    pub struct Client { /* fields omitted */ }

Light client implementation.

## Methods

### `impl Client`
[src]

#### `fn new(config: Config,
spec: &Spec,
io_channel: IoChannel<ClientIoMessage>)
-> Self`

Create a new `Client`.

#### `fn import_header(&self, header: Header) -> Result<H256, BlockImportError>`

Import a header to the queue for additional verification.

#### `fn import_own_transaction(&self, tx: PendingTransaction)`

Import a local transaction.

#### `fn ready_transactions(&self) -> Vec<PendingTransaction>`

Fetch a vector of all pending transactions.

#### `fn status(&self, hash: &H256) -> BlockStatus`

Inquire about the status of a given header.

#### `fn chain_info(&self) -> BlockChainInfo`

Get the chain info.

#### `fn queue_info(&self) -> QueueInfo`

Get the header queue info.

#### `fn get_header(&self, id: BlockId) -> Option<Bytes>`

Get a block header by Id.

#### `fn flush_queue(&self)`

Flush the header queue.

#### `fn cht_root(&self, i: usize) -> Option<H256>`

Get the `i`th CHT root.

#### `fn import_verified(&self)`

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

#### `fn report(&self) -> ClientReport`

Get a report about blocks imported.

#### `fn chain_mem_used(&self) -> usize`

Get blockchain mem usage in bytes.

## Trait Implementations

### `impl LightChainClient for Client`
[src]

#### `fn chain_info(&self) -> BlockChainInfo`

Get chain info.

#### `fn queue_header(&self, header: Header) -> Result<H256, BlockImportError>`

Queue header to be verified. Required that all headers queued have their parent queued prior. Read more

#### `fn is_known(&self, hash: &H256) -> bool`

Query whether a block is known.

#### `fn clear_queue(&self)`

Clear the queue.

#### `fn flush_queue(&self)`

Flush the queue.

#### `fn queue_info(&self) -> QueueInfo`

Get queue info.

#### `fn cht_root(&self, i: usize) -> Option<H256>`

Get the `i`th CHT root.

### `impl Provider for Client`
[src]

#### `fn chain_info(&self) -> BlockChainInfo`

Provide current blockchain info.

#### `fn reorg_depth(&self, _a: &H256, _b: &H256) -> Option<u64>`

Find the depth of a common ancestor between two blocks. If either block is unknown or an ancestor can't be found then return `None`. Read more

#### `fn earliest_state(&self) -> Option<u64>`

Earliest block where state queries are available. If `None`, no state queries are servable. Read more

#### `fn block_header(&self, id: BlockId) -> Option<Header>`

Get a block header by id.

#### `fn block_body(&self, _id: BlockId) -> Option<Body>`

Get a block body by id.

#### `fn block_receipts(&self, _hash: &H256) -> Option<Bytes>`

Get a block's receipts as an RLP-encoded list by block hash.

#### `fn state_proof(&self, _req: StateProof) -> Vec<Bytes>`

Get a state proof from a request. Each proof should be a vector of rlp-encoded trie nodes, in ascending order by distance from the root. Read more

#### `fn contract_code(&self, _req: ContractCode) -> Bytes`

Get contract code by request. Either the raw bytecode or empty.

#### `fn header_proof(&self, _req: HeaderProof) -> Option<(Header, Vec<Bytes>)>`

Provide a header proof from a given Canonical Hash Trie as well as the corresponding header. The first element is the block header and the second is a merkle proof of the CHT. Read more

#### `fn ready_transactions(&self) -> Vec<PendingTransaction>`

Provide pending transactions.

#### `fn block_headers(&self, req: Headers) -> Vec<Header>`

Provide a list of headers starting at the requested block, possibly in reverse and skipping `skip` at a time. Read more

#### `fn block_bodies(&self, req: Bodies) -> Vec<Option<Body>>`

Provide as many as possible of the requested blocks (minus the headers) encoded in RLP format. Read more

#### `fn receipts(&self, req: Receipts) -> Vec<Bytes>`

Provide the receipts as many as possible of the requested blocks. Returns a vector of RLP-encoded lists of receipts. Read more

#### `fn proofs(&self, req: StateProofs) -> Vec<Bytes>`

Provide a set of merkle proofs, as requested. Each request is a block hash and request parameters. Read more

#### `fn contract_codes(&self, req: ContractCodes) -> Vec<Bytes>`

Provide contract code for the specified (block_hash, account_hash) pairs. Each item in the resulting vector is either the raw bytecode or empty. Read more

#### `fn header_proofs(&self, req: HeaderProofs) -> Vec<Bytes>`

Provide header proofs from the Canonical Hash Tries as well as the headers they correspond to -- each element in the returned vector is a 2-tuple. The first element is a block header and the second a merkle proof of the header in a requested CHT. Read more

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)