stub implementation of provider for client
This commit is contained in:
parent
4b82392371
commit
a7e420d9ec
@ -136,6 +136,7 @@ pub mod miner;
|
|||||||
pub mod snapshot;
|
pub mod snapshot;
|
||||||
pub mod action_params;
|
pub mod action_params;
|
||||||
pub mod db;
|
pub mod db;
|
||||||
|
pub mod light;
|
||||||
#[macro_use] pub mod evm;
|
#[macro_use] pub mod evm;
|
||||||
|
|
||||||
mod cache_manager;
|
mod cache_manager;
|
||||||
|
@ -34,7 +34,7 @@ use io::IoChannel;
|
|||||||
use util::hash::H256;
|
use util::hash::H256;
|
||||||
use util::Bytes;
|
use util::Bytes;
|
||||||
|
|
||||||
/// A light client.
|
/// Light client implementation.
|
||||||
pub struct Client {
|
pub struct Client {
|
||||||
engine: Arc<Engine>,
|
engine: Arc<Engine>,
|
||||||
header_queue: HeaderQueue,
|
header_queue: HeaderQueue,
|
||||||
@ -69,3 +69,33 @@ impl Client {
|
|||||||
self.header_queue.queue_info()
|
self.header_queue.queue_info()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Provider for Client {
|
||||||
|
fn block_headers(&self, block: H256, skip: usize, max: usize, reverse: bool) -> Vec<Bytes> {
|
||||||
|
Vec::new()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn block_bodies(&self, blocks: Vec<H256>) -> Vec<Bytes> {
|
||||||
|
Vec::new()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn receipts(&self, blocks: Vec<H256>) -> Vec<Bytes> {
|
||||||
|
Vec::new()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn proofs(&self, requests: Vec<(H256, ProofRequest)>) -> Vec<Bytes> {
|
||||||
|
Vec::new()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn code(&self, accounts: Vec<(H256, H256)>) -> Vec<Bytes> {
|
||||||
|
Vec::new()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn header_proofs(&self, requests: Vec<CHTProofRequest>) -> Vec<Bytes> {
|
||||||
|
Vec::new()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn pending_transactions(&self) -> Vec<SignedTransaction> {
|
||||||
|
Vec::new()
|
||||||
|
}
|
||||||
|
}
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! Light client logic and implementation.
|
//! Light client logic and implementation.
|
||||||
//!
|
//!
|
||||||
//! A "light" client stores very little chain-related data locally
|
//! 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
|
//! It starts by performing a header-only sync, verifying every header in
|
||||||
//! the chain.
|
//! the chain.
|
||||||
|
|
||||||
mod provider;
|
|
||||||
mod client;
|
mod client;
|
||||||
|
mod provider;
|
||||||
|
mod sync;
|
||||||
|
|
||||||
pub use self::client::Client;
|
pub use self::client::Client;
|
||||||
pub use self::provider::{CHTProofRequest, ProofRequest, Provider};
|
pub use self::provider::{CHTProofRequest, ProofRequest, Provider};
|
@ -19,12 +19,15 @@
|
|||||||
|
|
||||||
pub use proof_request::{CHTProofRequest, ProofRequest};
|
pub use proof_request::{CHTProofRequest, ProofRequest};
|
||||||
|
|
||||||
|
use transaction::SignedTransaction;
|
||||||
|
|
||||||
use util::Bytes;
|
use util::Bytes;
|
||||||
use util::hash::H256;
|
use util::hash::H256;
|
||||||
|
|
||||||
/// Defines the operations that a provider for `LES` must fulfill.
|
/// Defines the operations that a provider for `LES` must fulfill.
|
||||||
///
|
///
|
||||||
/// These are defined at [1], but may be subject to change.
|
/// 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)
|
/// [1]: https://github.com/ethcore/parity/wiki/Light-Ethereum-Subprotocol-(LES)
|
||||||
pub trait Provider {
|
pub trait Provider {
|
||||||
@ -54,4 +57,7 @@ pub trait Provider {
|
|||||||
|
|
||||||
/// Provide header proofs from the Canonical Hash Tries.
|
/// Provide header proofs from the Canonical Hash Tries.
|
||||||
fn header_proofs(&self, requests: Vec<CHTProofRequest>) -> Vec<Bytes>;
|
fn header_proofs(&self, requests: Vec<CHTProofRequest>) -> Vec<Bytes>;
|
||||||
|
|
||||||
|
/// Provide pending transactions.
|
||||||
|
fn pending_transactions(&self) -> Vec<SignedTransaction>;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user