remove LESv2 requests

This commit is contained in:
Robert Habermeier 2016-11-06 19:05:19 +01:00
parent 44e36596c9
commit d573ef3cc2
4 changed files with 7 additions and 48 deletions

View File

@ -103,10 +103,6 @@ impl Provider for Client {
Vec::new()
}
fn block_deltas(&self, _req: request::BlockDeltas) -> Vec<Bytes> {
Vec::new()
}
fn pending_transactions(&self) -> Vec<SignedTransaction> {
Vec::new()
}

View File

@ -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),

View File

@ -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<Bytes>;
/// Provide block deltas.
fn block_deltas(&self, req: request::BlockDeltas) -> Vec<Bytes>;
/// Provide pending transactions.
fn pending_transactions(&self) -> Vec<SignedTransaction>;
}

View File

@ -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<H256>,
}
/// 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<TransactionProof>,
}
/// 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,
}
}
}