diff --git a/ethcore/light/src/client.rs b/ethcore/light/src/client.rs index 2d9b643bc..81355bf0f 100644 --- a/ethcore/light/src/client.rs +++ b/ethcore/light/src/client.rs @@ -103,10 +103,6 @@ impl Provider for Client { Vec::new() } - fn block_deltas(&self, _req: request::BlockDeltas) -> Vec { - Vec::new() - } - fn pending_transactions(&self) -> Vec { Vec::new() } diff --git a/ethcore/light/src/net/mod.rs b/ethcore/light/src/net/mod.rs index efbc391e1..9b707db2f 100644 --- a/ethcore/light/src/net/mod.rs +++ b/ethcore/light/src/net/mod.rs @@ -23,13 +23,14 @@ use io::TimerToken; use network::{NetworkProtocolHandler, NetworkService, NetworkContext, NetworkError, PeerId}; use rlp::{DecoderError, RlpStream, Stream, UntrustedRlp, View}; use util::hash::H256; -use util::{Mutex, RwLock}; +use util::{U256, Mutex, RwLock}; use std::collections::{HashMap, HashSet}; use std::sync::atomic::{AtomicUsize, Ordering}; use provider::Provider; use request::{self, Request}; +use self::buffer_flow::FlowManager; mod buffer_flow; @@ -47,8 +48,8 @@ mod packet { // the status packet. pub const STATUS: u8 = 0x00; - // broadcast that new block hashes have appeared. - pub const NEW_BLOCK_HASHES: u8 = 0x01; + // announcement of new block hashes or capabilities. + pub const ANNOUNCE: u8 = 0x01; // request and response for block headers pub const GET_BLOCK_HEADERS: u8 = 0x02; @@ -197,8 +198,8 @@ impl LightProtocol { unimplemented!() } - // Handle a new block hashes message. - fn new_block_hashes(&self, peer: &PeerId, io: &NetworkContext, data: UntrustedRlp) { + // Handle an announcement. + fn announcement(&self, peer: &PeerId, io: &NetworkContext, data: UntrustedRlp) { const MAX_NEW_HASHES: usize = 256; unimplemented!() @@ -327,7 +328,7 @@ impl NetworkProtocolHandler for LightProtocol { let rlp = UntrustedRlp::new(data); match packet_id { packet::STATUS => self.status(peer, io, rlp), - packet::NEW_BLOCK_HASHES => self.new_block_hashes(peer, io, rlp), + packet::ANNOUNCE => self.announcement(peer, io, rlp), packet::GET_BLOCK_HEADERS => self.get_block_headers(peer, io, rlp), packet::BLOCK_HEADERS => self.block_headers(peer, io, rlp), diff --git a/ethcore/light/src/provider.rs b/ethcore/light/src/provider.rs index 6d4fb2ea0..d6458bedd 100644 --- a/ethcore/light/src/provider.rs +++ b/ethcore/light/src/provider.rs @@ -60,9 +60,6 @@ pub trait Provider: Send + Sync { /// Provide header proofs from the Canonical Hash Tries. fn header_proofs(&self, req: request::HeaderProofs) -> Vec; - /// Provide block deltas. - fn block_deltas(&self, req: request::BlockDeltas) -> Vec; - /// Provide pending transactions. fn pending_transactions(&self) -> Vec; } \ No newline at end of file diff --git a/ethcore/light/src/request.rs b/ethcore/light/src/request.rs index 63ec07068..f5c594970 100644 --- a/ethcore/light/src/request.rs +++ b/ethcore/light/src/request.rs @@ -83,31 +83,6 @@ pub struct HeaderProofs { pub from_level: u32, } -/// A request for block deltas -- merkle proofs of all changed trie nodes and code. -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct BlockDeltas { - /// Block hashes deltas are being requested for. - pub block_hashes: Vec, -} - -/// A request for a single transaction merkle proof. -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct TransactionProof { - /// The block hash to use the initial state from. - pub block_hash: H256, - /// The address to treat as the sender of the transaction. - pub sender: Address, - /// The raw transaction request itself. - pub transaction: Transaction, -} - -/// A request for transaction merkle proofs. -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct TransactionProofs { - /// Transaction proof requests. - pub tx_reqs: Vec, -} - /// Kinds of requests. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Kind { @@ -123,10 +98,6 @@ pub enum Kind { Codes, /// Requesting header proofs (from the CHT). HeaderProofs, - /// Requesting block deltas. - Deltas, - /// Requesting merkle proofs for transactions. - TransactionProofs, } /// Encompasses all possible types of requests in a single structure. @@ -144,10 +115,6 @@ pub enum Request { Codes(ContractCodes), /// Requesting header proofs. HeaderProofs(HeaderProofs), - /// Requesting block deltas. - Deltas(BlockDeltas), - /// Requesting transaction proofs. - TransactionProofs(TransactionProofs), } impl Request { @@ -160,8 +127,6 @@ impl Request { Request::StateProofs(_) => Kind::StateProofs, Request::Codes(_) => Kind::Codes, Request::HeaderProofs(_) => Kind::HeaderProofs, - Request::Deltas(_) => Kind::Deltas, - Request::TransactionProofs(_) => Kind::TransactionProofs, } } } \ No newline at end of file