feat(light client): fetch block body from remote (#2527)

* feat(on_demand): block body request

* fix(light block req): no justific + one block

* fix(bad rebase)

* feat(protocol): add messages for `remote_body`

* fix(on demand body): remove needless `take()`

* fix(network): remove messages for `on_demand_body`

* fix(grumbles): use `hash` in `remote_body_requests`

As long as we can't compute `ordered_trie_root(body)` just compare that request.header.hash() == response.header.hash()

* fix(grumbles): `hdr.ext_root == trie_root(body)`

* fix(grumbles): propogate `Err` in `fn body()`

* fix(grumbles): Vec<Block::Extrinsic>

* fix(grumbles): util_fn for `not_impl` in tests

* fix(on remote body): tests `fetch` and `on_demand`

* docs(resolve todos)
This commit is contained in:
Niklas Adolfsson
2019-05-18 02:05:00 +02:00
committed by DemiMarie-parity
parent 55937d1f08
commit 009898f309
6 changed files with 328 additions and 27 deletions
+8
View File
@@ -288,6 +288,7 @@ impl<Block: BlockT> client::light::fetcher::Fetcher<Block> for LightFetcher {
type RemoteReadResult = FutureResult<Option<Vec<u8>>, client::error::Error>;
type RemoteCallResult = FutureResult<Vec<u8>, client::error::Error>;
type RemoteChangesResult = FutureResult<Vec<(NumberFor<Block>, u32)>, client::error::Error>;
type RemoteBodyResult = FutureResult<Vec<Block::Extrinsic>, client::error::Error>;
fn remote_header(
&self,
@@ -323,4 +324,11 @@ impl<Block: BlockT> client::light::fetcher::Fetcher<Block> for LightFetcher {
) -> Self::RemoteChangesResult {
unimplemented!("not (yet) used in tests")
}
fn remote_body(
&self,
_request: client::light::fetcher::RemoteBodyRequest<Block::Header>,
) -> Self::RemoteBodyResult {
unimplemented!("not (yet) used in tests")
}
}