From 5db17514fd81eab67199a1668493403c2a77dc77 Mon Sep 17 00:00:00 2001 From: arkpar Date: Mon, 1 Feb 2016 16:18:32 +0100 Subject: [PATCH] Fixed block queue test --- ethcore/src/block_queue.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/ethcore/src/block_queue.rs b/ethcore/src/block_queue.rs index 206388042..dabe047e9 100644 --- a/ethcore/src/block_queue.rs +++ b/ethcore/src/block_queue.rs @@ -337,23 +337,16 @@ mod tests { } #[test] - fn returns_error_for_verified_duplicates() { + fn returns_ok_for_drained_duplicates() { let mut queue = get_test_queue(); if let Err(e) = queue.import_block(get_good_dummy_block()) { panic!("error importing block that is valid by definition({:?})", e); } - queue.drain(10); queue.flush(); + queue.drain(10); - let duplicate_import = queue.import_block(get_good_dummy_block()); - match duplicate_import { - Err(e) => { - match e { - ImportError::AlreadyQueued => {}, - _ => { panic!("must return AlreadyQueued error"); } - } - } - Ok(_) => { panic!("must produce error"); } + if let Err(e) = queue.import_block(get_good_dummy_block()) { + panic!("error importing block that has already been drained ({:?})", e); } } }