Owning views of blockchain data (#3982)

* owning views of blockchain data

* port blockchain and client traits to owning views

* fix ethcore tests

* use strong headers and bodies in ethcore_light

* port ethsync to use owning views

* port rpc to owning views

* port parity informant and blockchain export
This commit is contained in:
Robert Habermeier
2016-12-28 13:44:51 +01:00
committed by Gav Wood
parent 592a3ac623
commit fe1f542c4f
22 changed files with 493 additions and 212 deletions

View File

@@ -706,7 +706,7 @@ impl LightProtocol {
stream.append(&req_id).append(&cur_buffer).begin_list(response.len());
for header in response {
stream.append_raw(&header, 1);
stream.append_raw(&header.into_inner(), 1);
}
stream.out()
@@ -757,7 +757,7 @@ impl LightProtocol {
let max_cost = peer.deduct_max(&self.flow_params, request::Kind::Bodies, req.block_hashes.len())?;
let response = self.provider.block_bodies(req);
let response_len = response.iter().filter(|x| &x[..] != &::rlp::EMPTY_LIST_RLP).count();
let response_len = response.iter().filter(|x| x.is_some()).count();
let actual_cost = self.flow_params.compute_cost(request::Kind::Bodies, response_len);
assert!(max_cost >= actual_cost, "Actual cost exceeded maximum computed cost.");
@@ -768,7 +768,10 @@ impl LightProtocol {
stream.append(&req_id).append(&cur_buffer).begin_list(response.len());
for body in response {
stream.append_raw(&body, 1);
match body {
Some(body) => stream.append_raw(&body.into_inner(), 1),
None => stream.append_empty_data(),
};
}
stream.out()