diff --git a/ethcore/src/lib.rs b/ethcore/src/lib.rs index 9985dc58e..cd32da999 100644 --- a/ethcore/src/lib.rs +++ b/ethcore/src/lib.rs @@ -136,6 +136,7 @@ pub mod miner; pub mod snapshot; pub mod action_params; pub mod db; +pub mod light; #[macro_use] pub mod evm; mod cache_manager; diff --git a/ethcore/src/light/client.rs b/ethcore/src/light/client.rs index 18635aa44..a4ff2531f 100644 --- a/ethcore/src/light/client.rs +++ b/ethcore/src/light/client.rs @@ -34,7 +34,7 @@ use io::IoChannel; use util::hash::H256; use util::Bytes; -/// A light client. +/// Light client implementation. pub struct Client { engine: Arc, header_queue: HeaderQueue, @@ -68,4 +68,34 @@ impl Client { pub fn queue_info(&self) -> QueueInfo { self.header_queue.queue_info() } +} + +impl Provider for Client { + fn block_headers(&self, block: H256, skip: usize, max: usize, reverse: bool) -> Vec { + Vec::new() + } + + fn block_bodies(&self, blocks: Vec) -> Vec { + Vec::new() + } + + fn receipts(&self, blocks: Vec) -> Vec { + Vec::new() + } + + fn proofs(&self, requests: Vec<(H256, ProofRequest)>) -> Vec { + Vec::new() + } + + fn code(&self, accounts: Vec<(H256, H256)>) -> Vec { + Vec::new() + } + + fn header_proofs(&self, requests: Vec) -> Vec { + Vec::new() + } + + fn pending_transactions(&self) -> Vec { + Vec::new() + } } \ No newline at end of file diff --git a/ethcore/src/light/mod.rs b/ethcore/src/light/mod.rs index 22b446074..863f35433 100644 --- a/ethcore/src/light/mod.rs +++ b/ethcore/src/light/mod.rs @@ -1,3 +1,19 @@ +// Copyright 2015, 2016 Ethcore (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + //! Light client logic and implementation. //! //! A "light" client stores very little chain-related data locally @@ -12,8 +28,9 @@ //! It starts by performing a header-only sync, verifying every header in //! the chain. -mod provider; mod client; +mod provider; +mod sync; pub use self::client::Client; -pub use self::provider::{CHTProofRequest, ProofRequest, Provider}; +pub use self::provider::{CHTProofRequest, ProofRequest, Provider}; \ No newline at end of file diff --git a/ethcore/src/light/provider.rs b/ethcore/src/light/provider.rs index 4833184eb..05859c78b 100644 --- a/ethcore/src/light/provider.rs +++ b/ethcore/src/light/provider.rs @@ -19,12 +19,15 @@ pub use proof_request::{CHTProofRequest, ProofRequest}; +use transaction::SignedTransaction; + use util::Bytes; use util::hash::H256; /// 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 an empty RLP list. /// /// [1]: https://github.com/ethcore/parity/wiki/Light-Ethereum-Subprotocol-(LES) pub trait Provider { @@ -54,4 +57,7 @@ pub trait Provider { /// Provide header proofs from the Canonical Hash Tries. fn header_proofs(&self, requests: Vec) -> Vec; + + /// Provide pending transactions. + fn pending_transactions(&self) -> Vec; } \ No newline at end of file