Make light client backend only work with locally available data (#3538)

* removing fetcher dependency from light backend

* fix compilation
This commit is contained in:
Svyatoslav Nikolsky
2019-09-12 18:13:26 +03:00
committed by Gavin Wood
parent fd924c07ed
commit 634ca73e50
10 changed files with 267 additions and 563 deletions
+6 -21
View File
@@ -73,20 +73,11 @@ pub type Executor = client::LocalCallExecutor<
pub type LightBackend = generic_test_client::LightBackend<runtime::Block>;
/// Test client light executor.
pub type LightExecutor = client::light::call_executor::RemoteOrLocalCallExecutor<
runtime::Block,
pub type LightExecutor = client::light::call_executor::GenesisCallExecutor<
LightBackend,
client::light::call_executor::RemoteCallExecutor<
client::light::blockchain::Blockchain<
client_db::light::LightStorage<runtime::Block>,
LightFetcher
>,
LightFetcher
>,
client::LocalCallExecutor<
client::light::backend::Backend<
client_db::light::LightStorage<runtime::Block>,
LightFetcher,
Blake2Hasher
>,
NativeExecutor<LocalExecutor>
@@ -271,22 +262,16 @@ pub fn new_light() -> (
let blockchain = Arc::new(client::light::blockchain::Blockchain::new(storage));
let backend = Arc::new(LightBackend::new(blockchain.clone()));
let executor = NativeExecutor::new(None);
let fetcher = Arc::new(LightFetcher);
let remote_call_executor = client::light::call_executor::RemoteCallExecutor::new(
blockchain.clone(),
fetcher,
);
let local_call_executor = client::LocalCallExecutor::new(backend.clone(), executor, None);
let call_executor = LightExecutor::new(
backend.clone(),
remote_call_executor,
local_call_executor,
);
(TestClientBuilder::with_backend(backend.clone())
.build_with_executor(call_executor)
.0,
backend,
(
TestClientBuilder::with_backend(backend.clone())
.build_with_executor(call_executor)
.0,
backend,
)
}