Allow for customisation of chain selection systems (#2240)

* move SelectChain trait out of client

* Extend SelectChain, move longest chain implementation into it

* Bring SelectChain into service

* implement LongestChain SelectChain

* implement longest chain for node

* update Cargo.lock's

* in between erroring tests

* deprecate ::backend and ::import_lock

* Remove unneded space

Co-Authored-By: gnunicorn <ben.kampmann@googlemail.com>

* Remove unneded space

Co-Authored-By: gnunicorn <ben.kampmann@googlemail.com>

* Fixes test compilation

* remove todo

* re-enable client test

* add doc

* fixing tests

* Clarify SelectChain Interface, intended implementation and usage

* minor components cleanups

* minor cleanups

* Update lock files

* Implement cleaner interface for SelectChain

* addressing comments

* Updating tests

* bump node runtime impl version

* address grumbles
This commit is contained in:
Benjamin Kampmann
2019-05-10 14:08:12 +02:00
committed by Gavin Wood
parent 32fdeed21c
commit 18ca0170c3
22 changed files with 717 additions and 339 deletions
@@ -27,6 +27,8 @@ use state_machine::{
execution_proof_check_on_trie_backend,
};
use client::LongestChain;
use consensus_common::SelectChain;
use codec::Encode;
fn calling_function_with_strat(strat: ExecutionStrategy) {
@@ -156,7 +158,8 @@ fn record_proof_works() {
let client = test_client::new_with_execution_strategy(ExecutionStrategy::Both);
let block_id = BlockId::Number(client.info().unwrap().chain.best_number);
let storage_root = client.best_block_header().unwrap().state_root().clone();
let storage_root = LongestChain::new(client.backend().clone(), client.import_lock())
.best_chain().unwrap().state_root().clone();
let transaction = Transfer {
amount: 1000,