Build LongestChain with TestClientBuilder (#2792)

* Switch to `TestClientBuilder` and support generating LongestChain

* Make sure test-client works without the wasm blob

* Use `TestClientBuilder` in more places
This commit is contained in:
Bastian Köcher
2019-06-05 13:45:18 +02:00
committed by GitHub
parent 22a00a3353
commit 4f888f34d3
10 changed files with 321 additions and 334 deletions
@@ -26,7 +26,7 @@ use crate::{TestClient, AccountKeyring};
use runtime_primitives::traits::Block as BlockT;
use crate::backend;
use crate::blockchain::{Backend as BlockChainBackendT, HeaderBackend};
use crate::{BlockBuilderExt, new_with_backend};
use crate::{BlockBuilderExt, TestClientBuilder};
use runtime::{self, Transfer};
use runtime_primitives::generic::BlockId;
@@ -40,7 +40,7 @@ pub fn test_leaves_for_backend<B: 'static>(backend: Arc<B>) where
// B2 -> C3
// A1 -> D2
let client = new_with_backend(backend.clone(), false);
let client = TestClientBuilder::new_with_backend(backend.clone()).build();
let blockchain = backend.blockchain();
let genesis_hash = client.info().chain.genesis_hash;
@@ -156,7 +156,7 @@ pub fn test_children_for_backend<B: 'static>(backend: Arc<B>) where
// B2 -> C3
// A1 -> D2
let client = new_with_backend(backend.clone(), false);
let client = TestClientBuilder::new_with_backend(backend.clone()).build();
let blockchain = backend.blockchain();
// G -> A1
@@ -246,7 +246,7 @@ pub fn test_blockchain_query_by_number_gets_canonical<B: 'static>(backend: Arc<B
// A1 -> B2 -> B3 -> B4
// B2 -> C3
// A1 -> D2
let client = new_with_backend(backend.clone(), false);
let client = TestClientBuilder::new_with_backend(backend.clone()).build();
let blockchain = backend.blockchain();
// G -> A1