Support synching of blocks that are not new_best (#6508)

* Start

* Remove debug println

* Add tests
This commit is contained in:
Bastian Köcher
2020-06-30 16:44:52 +02:00
committed by GitHub
parent 4fd770dcf9
commit 53be6ec510
9 changed files with 172 additions and 53 deletions
@@ -59,7 +59,7 @@ fn import_single_good_block_works() {
&mut substrate_test_runtime_client::new(),
BlockOrigin::File,
block,
&mut PassThroughVerifier(true)
&mut PassThroughVerifier::new(true)
) {
Ok(BlockImportResult::ImportedUnknown(ref num, ref aux, ref org))
if *num == number && *aux == expected_aux && *org == Some(peer_id) => {}
@@ -74,7 +74,7 @@ fn import_single_good_known_block_is_ignored() {
&mut client,
BlockOrigin::File,
block,
&mut PassThroughVerifier(true)
&mut PassThroughVerifier::new(true)
) {
Ok(BlockImportResult::ImportedKnown(ref n)) if *n == number => {}
_ => panic!()
@@ -89,7 +89,7 @@ fn import_single_good_block_without_header_fails() {
&mut substrate_test_runtime_client::new(),
BlockOrigin::File,
block,
&mut PassThroughVerifier(true)
&mut PassThroughVerifier::new(true)
) {
Err(BlockImportError::IncompleteHeader(ref org)) if *org == Some(peer_id) => {}
_ => panic!()
@@ -101,7 +101,7 @@ fn async_import_queue_drops() {
let executor = sp_core::testing::SpawnBlockingExecutor::new();
// Perform this test multiple times since it exhibits non-deterministic behavior.
for _ in 0..100 {
let verifier = PassThroughVerifier(true);
let verifier = PassThroughVerifier::new(true);
let queue = BasicQueue::new(
verifier,