Trait ethcore_light::provider::Provider [] [src]

pub trait Provider: Send + Sync {
    fn chain_info(&self) -> BlockChainInfo;
    fn reorg_depth(&self, a: &H256, b: &H256) -> Option<u64>;
    fn earliest_state(&self) -> Option<u64>;
    fn block_header(&self, id: BlockId) -> Option<Header>;
    fn block_body(&self, id: BlockId) -> Option<Body>;
    fn block_receipts(&self, hash: &H256) -> Option<Bytes>;
    fn state_proof(&self, req: StateProof) -> Vec<Bytes>;
    fn contract_code(&self, req: ContractCode) -> Bytes;
    fn header_proof(&self, req: HeaderProof) -> Option<(Header, Vec<Bytes>)>;
    fn ready_transactions(&self) -> Vec<PendingTransaction>;

    fn block_headers(&self, req: Headers) -> Vec<Header> { ... }
    fn block_bodies(&self, req: Bodies) -> Vec<Option<Body>> { ... }
    fn receipts(&self, req: Receipts) -> Vec<Bytes> { ... }
    fn proofs(&self, req: StateProofs) -> Vec<Bytes> { ... }
    fn contract_codes(&self, req: ContractCodes) -> Vec<Bytes> { ... }
    fn header_proofs(&self, req: HeaderProofs) -> Vec<Bytes> { ... }
}

Defines the operations that a provider for LES must fulfill.

These are defined at 1, but may be subject to change. Requests which can't be fulfilled should return either an empty RLP list or empty vector where appropriate.

Required Methods

Provide current blockchain info.

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.

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

Get a block header by id.

Get a block body by id.

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

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.

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

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.

Provide pending transactions.

Provided Methods

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

The returned vector may have any length in the range [0, max], but the results within must adhere to the skip and reverse parameters.

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

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

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

Returns a vector of RLP-encoded lists satisfying the requests.

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

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.

Implementors