From 984674f39ecf7da6a69c376984cf7629cadbf7ff Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Mon, 16 Jul 2018 21:05:47 +0200 Subject: [PATCH] fix verification in ethcore-sync collect_blocks (#9135) --- ethcore/sync/src/block_sync.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ethcore/sync/src/block_sync.rs b/ethcore/sync/src/block_sync.rs index bff9bb071..2e508f4d6 100644 --- a/ethcore/sync/src/block_sync.rs +++ b/ethcore/sync/src/block_sync.rs @@ -477,18 +477,19 @@ impl BlockDownloader { for block_and_receipts in blocks { let block = block_and_receipts.block; let receipts = block_and_receipts.receipts; + + // Perform basic block verification + if !Block::is_good(&block) { + debug!(target: "sync", "Bad block rlp: {:?}", block); + bad = true; + break; + } + let (h, number, parent) = { let header = view!(BlockView, &block).header_view(); (header.hash(), header.number(), header.parent_hash()) }; - // Perform basic block verification - if !Block::is_good(&block) { - debug!(target: "sync", "Bad block rlp {:?} : {:?}", h, block); - bad = true; - break; - } - if self.target_hash.as_ref().map_or(false, |t| t == &h) { self.state = State::Complete; trace!(target: "sync", "Sync target reached");